AmiNadimi
AmiNadimi

Reputation: 5715

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:multidex:1.0.3

I was trying to update my Android Studio 2.2.3 to version 3 but when i did, below error blocked the build process :

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:multidex:1.0.3.

Could not resolve com.android.support:multidex:1.0.3. Required by: project :app

Could not resolve com.android.support:multidex:1.0.3.

Could not parse POM https://dl.google.com/dl/android/maven2/com/android/support/multidex/1.0.3/multidex-1.0.3.pom

Already seen doctype.

build.gradle(Module: app) :

buildscript {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

apply plugin: 'com.android.application'

repositories {
    jcenter()
    flatDir {
        dirs 'libs'
    }
    google()
}

android {

    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "My.App.Id"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 111
        versionName "1.1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:design:+'
    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.github.rahatarmanahmed:circularprogressview:+'
    compile files('libs/devicedriverslib.jar')
    compile files('libs/allutils.jar')
    compile 'com.android.support:multidex:1.0.3'
}

build.gradle(Project: MyProjectName)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        google()
        jcenter()
    }

}

Installed Build Tools : enter image description here

gradle-wrapper.properties :

#Tue Oct 31 12:15:03 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

Upvotes: 0

Views: 3312

Answers (2)

Derekyy
Derekyy

Reputation: 1038

I encountered this problem since i had set Global Gradle settings to Offline work

  1. Click File > Settings (on macOS, Android Studio > Preferences) to open the Settings dialog.
  2. In the left pane, expand Build, Execution, Deployment and then click Gradle.
  3. Under Global Gradle settings, uncheck the Offline work checkbox.
  4. Click Apply or OK for your changes to take effect.
  5. Rebuild Gradle

Source: Configure Android Studio

Upvotes: 1

AmiNadimi
AmiNadimi

Reputation: 5715

If you are behind a firewall or even if you are in a forbidden country, you have to bypass the restrictions via a VPN tool or add the correct exceptions in the firewall. (free proxies like Psyphon and weak stuff won't work! you might wanna consider buying a good VPN!)

the problem is about correct internet connection, so double check your network and internet connection and any limitations related.

Upvotes: 0

Related Questions