繁体   English   中英

Android Merge libs gradle

[英]Android Merge libs gradle

我的gradle文件:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1002
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }



}
dependencies {
    api fileTree(include: ['*.jar'], dir: 'libs')
    api 'androidx.appcompat:appcompat:1.0.2'
    api 'androidx.palette:palette:1.0.0'
    api 'androidx.mediarouter:mediarouter:1.0.0'
    api 'androidx.cardview:cardview:1.0.0'
    api 'androidx.legacy:legacy-support-v4:1.0.0'
    api 'androidx.recyclerview:recyclerview:1.0.0'
    api 'androidx.annotation:annotation:1.0.1'
    api 'androidx.percentlayout:percentlayout:1.0.0'
    api "androidx.fragment:fragment:1.1.0-alpha03"
    api 'androidx.preference:preference:1.0.0'



}

在构建应用程序时,出现下一个错误:

 Task :mobile:transformClassesWithMultidexlistForDebug FAILED
AGPBI: {"kind":"error","text":"Program type already present: com.google.common.util.concurrent.ListenableFuture","sources":[{}],"tool":"D8"}

FAILURE: Build failed with an exception.

 What went wrong:
Execution failed for task ':mobile:transformClassesWithMultidexlistForDebug'.
 com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives: 
  Program type already present: com.google.common.util.concurrent.ListenableFuture

我发现了错误。 库不兼容"androidx.fragment:fragment:1.1.0-alpha03"'androidx.appcompat:appcompat:1.0.2'

如何在不删除androidx.fragment依赖关系的情况下解决错误?

UPD。 解:

api 'androidx.appcompat:appcompat:1.1.0-alpha01'
api "androidx.fragment:fragment:1.0.0"

解:

更换:

api 'androidx.appcompat:appcompat:1.0.2'
api "androidx.fragment:fragment:1.1.0-alpha03"

至:

api 'androidx.appcompat:appcompat:1.1.0-alpha01'
api "androidx.fragment:fragment:1.0.0"

希望AndroidX库将变得更加稳定...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM