我正在尝试将依赖项从v:7:26. +升级到v:7.28.0.0,同步还可以,但是当我尝试运行该应用程序时抛出了多个dex错误,我不确定它在抱怨什么,也尝试将multidex依赖关系也从1.0.1更新为1.0.3,但无济于事。请帮忙!
错误:定义了多个dex文件 Lcom / google / common / util / concurrent / ListenableFuture;
我的应用Gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myapp.findme"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.3'
// Temporary fix until alpha10
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.google.android.material:material:1.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//implementation 'com.android.support:design:26.+'
//implementation 'com.android.support:cardview-v7:26.+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
/**
* https://github.com/JakeWharton/butterknife
* Avoid findViewById calls by using @BindView on field
* note: cannot go to 10.10.0, require min sdk 26
*/
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support:multidex:1.0.3'
// for firebase and firestore
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
// for LinkedIn
compile project(path: ':linkedin-sdk')
// for facebook
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.code.gson:gson:2.8.2'
// for BLE
//implementation 'org.altbeacon:android-beacon-library:2.15+'
//implementation 'org.altbeacon:android-beacon-library:2.15.2'
compile(name: 'android-beacon-library-more-reliable-service-stop2-1-g7dbb6b3', ext: 'aar')
// life cycle
implementation 'android.arch.lifecycle:extensions:1.0.0'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0"
// *** Jetpack ***
//
// Release note https://developer.android.com/jetpack/docs/release-notes
// for ROOM
implementation 'com.amitshekhar.android:debug-db:1.0.4'
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
// for work manager
def work_version = "1.0.0-alpha09"
implementation "android.arch.work:work-runtime:$work_version"
// *** End of JackPack ***
// for google play service (location)
implementation 'com.google.android.gms:play-services-location:15.0.1'
// for google login
implementation 'com.google.android.gms:play-services-auth:15.0.1'
// for fire storage
implementation 'com.google.firebase:firebase-storage:16.0.1'
// for image
//implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.android.support:exifinterface:28+'
// for crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
// for bugfender
implementation 'com.bugfender.sdk:android:1.+'
// userful method
implementation 'org.apache.commons:commons-lang3:3.4'
}
apply plugin: 'com.google.gms.google-services'
我的项目成绩
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
maven {
// for crashlytics
url 'https://maven.fabric.io/public'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
//classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// for crashlytics
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
// for crashlytics
maven {
url 'https://maven.google.com/'
}
flatDir {
dirs 'src/main/libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:1)
解决方案:将具有listenablefuture
模块的Guava组从当前传递依赖项中排除
implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
另外,对linkedin-sdk使用此配置:
api project(path: ':linkedin-sdk') {
transitive = true
}
原因:
这是有意为之的! (reference)然而,新版本的Guava即将面世,当然可以解决问题。目前,排除上述问题应该可以正常工作。