将我的项目迁移到 AndroidX 后,出现以下错误: 程序类型已存在 androidx.concurrent.futures.DirectExecutor
我的应用程序 Gradle 如下:
configurations.all {
exclude group: 'org.slf4j'
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:0.5'
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
transitive = true
}
implementation project(':data')
implementation project(':hardware')
implementation project(':rulescontracts')
implementation project(':rules')
implementation project(':sdfclient')
implementation project(':sunmiclient')
implementation project(':sync')
implementation project(':till')
implementation project(':ui')
implementation project(':webapi')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0-alpha01'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.guava:guava:24.0-android'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'net.zetetic:android-database-sqlcipher:3.5.9@aar'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.zxing:core:3.2.1'
testImplementation 'org.robolectric:robolectric:3.7.1'
testImplementation 'junit:junit:4.12'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'net.danlew:android.joda:2.7.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation files('libs/commons-codec-1.9.jar')
testImplementation 'org.mockito:mockito-core:2.8.9'
testImplementation 'org.robolectric:shadows-multidex:3.0'
androidTestImplementation 'androidx.annotation:annotation:1.0.1'
implementation files('libs/DS_Lib-release.aar')
implementation files('libs/Zapper.SDK.QRCode-0.0.7.jar')
implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
}
apply plugin: 'com.google.gms.google-services'
我还检查了我的导入,以确保不存在建议的重复实现 here
最佳答案
我解决这个问题的方法是包含以下内容:
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
在(模块:应用程序)中,大多数解决方案建议,如果您遇到此问题,请在模块 gradle 中包含以下内容:
implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
这会导致以下问题:程序类型已存在 androidx.concurrent.futures.DirectExecutor。
关于Androidx迁移: Program type already present androidx.并发.futures.DirectExecutor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54034359/