我对这个错误感到困惑。
More than one file was found with OS independent path 'META-INF/androidx.appcompat_appcompat.version'
这是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.ciangproduction.sestyc"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:28.0.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation(name: 'sinch-android-rtc', version: '+', ext: 'aar')
implementation 'com.squareup.picasso:picasso:2.5.0'
//implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.yalantis:ucrop:2.2.2-native'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
implementation 'com.android.volley:volley:1.1.0'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我已经尝试了所有具有类似错误代码的内容,例如使用PackagingOptions排除了它。但是它仍然显示相同的错误代码。一切正常,直到我尝试将依赖项值更改为最新值为止。(对不起,英语不好)
答案 0 :(得分:0)
您必须排除重复的依赖项(必须保留一个):
dependencies {
implementation ("com.github.chrisbanes:PhotoView:2.2.0") {
exclude group: "androidx.appcompat", module: "appcompat"
}
}
ucrop
也有com.android.support:appcompat-v7:27.1.0
...
将迁移到androidx
并排除所有传递依赖项并声明它们。
请参见migration guide。