Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.0 Beta 1: Failed to resolve: com.android.support:multidex:1.0.2

After migrating from Android Studio 3.0 (Canary 5) to Android Studio 3.0 (Beta 1), and moving to latest gradle , i.e. 'com.android.tools.build:gradle:3.0.0-beta1'

When I try to gradle sync, it error stating below.

Failed to resolve: com.android.support:multidex:1.0.2 
Failed to resolve: com.android.support:multidex-instrumentation:1.0.2 

I check on Android Studio 3.0 Canary 9 - Failed to resolve packages, it doesn't solve my problem, as I already have this

    maven {
        url 'https://maven.google.com'
    }

I'm surprise it is even asking for multidex 1.0.2, as I only have in my build.gradle

compile 'com.android.support:multidex:1.0.1'

I check using ./gradlew app:dependencies | grep multidex, it shows the failures as below (across various flavors etc)

+--- com.android.support:multidex-instrumentation:1.0.2 FAILED
+--- com.android.support:multidex:1.0.1
+--- com.android.support:multidex:1.0.2 FAILED
+--- com.android.support:multidex:1.0.1 -> 1.0.2 FAILED

Where did the dependencies of multidex:1.0.2 and multidex-instrumentation:1.0.2 comes from? How could I solve this problem?

like image 363
Elye Avatar asked Aug 10 '17 08:08

Elye


3 Answers

Apparently my issue is I should post this:

maven {
    url 'https://maven.google.com'
}

in allprojects and not in buildscript (the subtle different has blinded me where the issue is), which then looks like this:

allprojects {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
    }
}

Thanks to M D for the pointers!

like image 158
Elye Avatar answered Nov 15 '22 00:11

Elye


For me, the solution is move the google() item up to make sure it's before the jcenter(). And actually, I will put the google() in the first place of all the repositories.

like image 34
blade Avatar answered Nov 15 '22 02:11

blade


Need to add the following as well:

compile 'com.android.support:multidex:1.0.3'

After adding the above line, it worked for me in addition to the above answer

like image 10
UVM Avatar answered Nov 15 '22 00:11

UVM