Search code examples
androidmavenandroid-studiogradleandroid-multidex

Failed to resolve: multidex-instrumentation


Whilst implementing multidex I'm encountering the following error whenever I sync my project.

Failed to resolve: multidex-instrumentation

I used these instructions to set it up.

Here is the relevant app-level build.gradle:

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "xxx.xyz.zzz"
        minSdkVersion 16
        targetSdkVersion 22
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}
dependencies {
    compile 'com.android.support:multidex:1.0.3'
    ....and the rest
}

And the relevant project-level build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.1.2'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

What am I missing here?


Solution

  • Add the below dependency in you gradle file and check. I was facing the same issue and by adding this it resolved the issue.

    androidTestImplementation 'com.android.support:multidex-instrumentation:1.0.3'