Android 종속성에는 컴파일 및 런타임에 대한 버전이 다릅니다.
Android Studio를 Canary 3 에서 Canary 4로 업데이트 한 후 빌드시 다음 오류가 발생합니다.
Android 종속성 'com.android.support:support-support-v4'에는 컴파일 (25.2.0) 및 런타임 (26.0.0-beta2) 클래스 경로에 대한 버전이 다릅니다. DependencyResolution을 통해 동일한 버전을 수동으로 설정해야합니다.
프로젝트 전체에서 전체 검색을 실행했으며 버전 25.1.0
은 사용되는 곳이 없습니다.
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'
}
참고 : 프로젝트는 Canary 3에서 잘 구축되었습니다.
빌드 스크립트 (build.gradle 루트)에서 다음 코드를 사용하세요.
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
The answer for me was to also add this to my build.gradle
file:
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
In my case, it was nessisary to enclose the resolution strategy in a configurations.all { .. }
block. I placed the configurations.all
block directly into my app/build.gradle
file (ie configurations.all
was not nested in anything else)
This worked for me:
Add the follow line in app/build.gradle
in dependencies section:
implementation "com.android.support:appcompat-v7:27.1.0"
or :27.1.1
in my case
I resolved it by following what Eddi mentioned above,
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
Switching my conflicting dependencies from implementation to api does the trick. Here's a good article by mindorks explaining the difference.
https://medium.com/mindorks/implementation-vs-api-in-gradle-3-0-494c817a6fa
Edit:
Here's my dependency resolutions as well
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "28.0.0"
}
if (details.requested.group == 'com.google.android.gms'
&& details.requested.name.contains('play-services-base')) {
details.useVersion "15.0.1"
}
if (details.requested.group == 'com.google.android.gms'
&& details.requested.name.contains('play-services-tasks')) {
details.useVersion "15.0.1"
}
}
}
}
See in your library projects make the compileSdkVersion and targetSdkVersion version to same level as your application is
android {
compileSdkVersion 28
defaultConfig {
consumerProguardFiles 'proguard-rules.txt'
minSdkVersion 14
targetSdkVersion 28
}
}
also make all dependencies to same level
If anyone getting this dependency issue in 2019, update Android Studio to 3.4 or later
I comment out //api 'com.google.android.gms:play-services-ads:15.0.1'
it worked for me after sync
Just add these lines in your build.gradle file
resolutionStrategy.force "com.android.support:support-media-compat:26.0.0-beta2"
resolutionStrategy.force "com.android.support:support-v4:26.0.0-beta2"
I solved it by upgrading my gradle dependency in the android/build.gradle file: classpath 'com.android.tools.build:gradle:3.3.1' (I was previously on version 3.2.
Replace a hard coded version to + example:
implementation 'com.google.android.gms:play-services-base:+'
implementation 'com.google.android.gms:play-services-maps:+'
'program tip' 카테고리의 다른 글
HTML 스팬 정렬 센터가 작동하지 않습니까? (0) | 2020.08.20 |
---|---|
CSS : 요소의 내용 앞에 공백을 추가하는 방법은 무엇입니까? (0) | 2020.08.20 |
Proguard를 사용할 때 특정 패키지 경로를 유지 / 제외하는 방법은 무엇입니까? (0) | 2020.08.20 |
파이썬에서“EOF가 아닐 때”에 대한 완벽한 대응은 무엇입니까? (0) | 2020.08.20 |
Rails 3에서 ActiveRecord 제거 (0) | 2020.08.20 |