【问题标题】:Androidx migration: Program type already present androidx.concurrent.futures.DirectExecutorAndroidx 迁移:程序类型已经存在 androidx.concurrent.futures.DirectExecutor
【发布时间】:2019-01-04 06:57:41
【问题描述】:

将我的项目迁移到 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

【问题讨论】:

    标签: android androidx


    【解决方案1】:

    我解决它的方法是包含以下内容:

    configurations {
        all*.exclude group: 'com.google.guava', module: 'listenablefuture'
    }
    

    在 (Module:app) 中,大多数解决方案建议如果您遇到此问题,请在模块 gradle 中包含以下内容:

    implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
        exclude group: 'com.google.guava', module: 'listenablefuture' 
    }
    

    这会导致以下问题:程序类型已存在 androidx.concurrent.futures.DirectExecutor。

    【讨论】:

    • 你拯救了我的夜晚@George!构建成功!
    猜你喜欢
    • 2020-01-27
    • 1970-01-01
    • 1970-01-01
    • 2019-05-28
    • 1970-01-01
    • 2018-09-23
    • 2019-02-22
    • 1970-01-01
    • 2018-10-21
    相关资源
    最近更新 更多