Reputation: 1001
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?
Upvotes: 4
Views: 4284
Reputation: 535
React-native + rnn v2 got stuck with same problem sollution: If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:
android {
defaultConfig {
// ...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true }
// ...
}
// ...
}
However, if your minSdkVersion is set to 20 or lower, then you must use the multidex support library as follows: then follow the official instructions here https://developer.android.com/studio/build/multidex
Upvotes: 0
Reputation: 589
solved for me just by moving google() after the maven repository for google in all projects repositories in the project build.gradle file
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven{url "https://maven.google.com"}
google()
}
}
Upvotes: 0
Reputation: 2889
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'
Upvotes: 8