如何解决以下错误?
1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-26.1.0-runtime.jar (com.android.support:support-compat:26.1.0)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
Gradle配置:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.postmaker"
minSdkVersion 19
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
configurations.all {
resolutionStrategy {
force 'androidx.appcompat:appcompat:1.1.0'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation files('libs/photoeditor.jar')
implementation files('libs/filtres/AutoLayout.jar')
implementation 'com.facebook.android:audience-network-sdk:4.99.1'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:core:1.2.0'
implementation 'androidx.core:core-ktx:1.1.0'
// AndroidJUnitRunner and JUnit Rules
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
}
答案 0 :(得分:0)
我自己解决了问题hurraaaaaaaaaah! 经过长时间的搜索,我得到了解决方案,方法是从Facebook受众网络中排除com.android.support和support-v4组。
实现('com.facebook.android:audience-network-sdk:5.6.0'){ 排除组:“ com.android.support” 排除模块:“ support-v4” }