After updating Android Studio from Canary 3 to Canary 4, the following error is thrown at the build time.
Android dependency 'com.android.support:support-support-v4' has different version for the compile (25.2.0) and runtime (26.0.0-beta2) classpath. You should manually set the same version via DependencyResolution.
I ran a complete search throughout the project and the version 25.1.0
is no where used.
App-build.gradle
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "com.xxx.xxxx"
minSdkVersion 14
targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
lintOptions {
abortOnError false
}
}}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation project(':core')
implementation com.google.android.gms:play-services-gcm:9.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true
}
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.flurry.android:analytics:7.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
Library-build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion
versionCode 1
versionName "1.0"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation files('libs/model.jar')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:percent:26.0.0-beta2'
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation 'com.android.support:support-core-utils:26.0.0-beta2'
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.android.support:design:26.0.0-beta2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
}
Note: Project was building fine in Canary 3
Use this code in your buildscript (build.gradle root):
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "version which should be used - in your case 26.0.0-beta2"
}
}
}
}
I had the same error, what solve my problem was. In my library instead of using compile or implementation i use "api". So in the end my dependencies:
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api files('libs/model.jar')
testApi 'junit:junit:4.12'
api 'com.android.support:percent:26.0.0-beta2'
api 'com.android.support:appcompat-v7:26.0.0-beta2'
api 'com.android.support:support-core-utils:26.0.0-beta2'
api 'com.squareup.retrofit2:retrofit:2.0.2'
api 'com.squareup.picasso:picasso:2.4.0'
api 'com.squareup.retrofit2:converter-gson:2.0.2'
api 'com.squareup.okhttp3:logging-interceptor:3.2.0'
api 'uk.co.chrisjenx:calligraphy:2.2.0'
api 'com.google.code.gson:gson:2.2.4'
api 'com.android.support:design:26.0.0-beta2'
api 'com.github.PhilJay:MPAndroidChart:v3.0.1'
}
You can find more info about "api", "implementation" in this link https://stackoverflow.com/a/44493379/3479489
You should be able to see exactly which dependency is pulling in the odd version as a transitive dependency by running the correct gradle -q dependencies
command for your project as described here:
https://docs.gradle.org/current/userguide/userguide_single.html#sec:listing_dependencies
Once you track down what's pulling it in, you can add an exclude to that specific dependency in your gradle file with something like:
implementation("XXXXX") {
exclude group: 'com.android.support', module: 'support-compat'
}
After a lot of time and getting help from a friend who knows a lot more than me about android: app/build.gradle
android {
compileSdkVersion 27
// org.gradle.caching = true
defaultConfig {
applicationId "com.cryptoviewer"
minSdkVersion 16
targetSdkVersion 23
versionCode 196
versionName "16.83"
// ndk {
// abiFilters "armeabi-v7a", "x86"
// }
}
and dependencies
dependencies {
implementation project(':react-native-camera')
//...
implementation "com.android.support:appcompat-v7:26.1.0" // <= YOU CARE ABOUT THIS
implementation "com.facebook.react:react-native:+" // From node_modules
}
in build.gradle
allprojects {
//...
configurations.all {
resolutionStrategy.force "com.android.support:support-v4:26.1.0"
}
in gradle.properties
android.useDeprecatedNdk=true
android.enableAapt2=false
org.gradle.jvmargs=-Xmx4608M
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With