Мой файл 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"