1
votes

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

In my Unity project for Android, I had references over 65k and my build system was gradle So, I needed to enable multidex. for that, I enabled custom gradle in Unity settings. Added “multiDexEnabled true” under defaultconfig.

but when I built on Android, I received the error “Failed to resolve: com.android.support:multidex:1.0.2”

So, I went into my android sdk -> extras -> m2repository->com->android->support to see if there is a multidex folder there was no folder inside it then I went to extras ->android->m2repository->com->android->support and there was multidex folder.

but it had versions 1.0.0 and 1.0.1 in it, not the 1.0.2 I have searched all over the internet how to download version 1.0.2 of multidex but could not find it. I even tried using compile ’com.android.support:multidex:1.0.1’ because this version was present but it did not work.

2

2 Answers

4
votes

I ran into the same problem. Editing the .gradle file did not help. I don't know why Unity is still trying to find a 1.0.2 version. I solved this problem as follows:

  1. Download .pom and .aar files here: https://mvnrepository.com/artifact/com.android.support/multidex/1.0.2
  2. Download .pom and .aar files for multidex-instrumentation here: https://mvnrepository.com/artifact/com.android.support/multidex-instrumentation/1.0.2
  3. Create folders ...\m2repository\com\android\support\multidex-instrumentation\1.0.2 and ...\m2repository\com\android\support\multidex\1.0.2 and copy corresponding .pom and .aar there.
2
votes

you need add google maven:

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