I am trying to upgrade dependencies from v:7:26.+ to v:7.28.0.0, sync is okay, but Multiple dex error is thrown when I try to run the app, i am not sure what it is complaining, tried to update the multidex dependency from 1.0.1 to 1.0.3 as well but doesn't help. Please help!
Error: Multiple dex files define Lcom/google/common/util/concurrent/ListenableFuture;
My App 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'
My project gradle
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
}
Solution: Excluding Guava group with
listenablefuture
module from current transitive dependencyAlso, use this configuration for linkedin-sdk:
Reason:
As per Google Issue Tracker,
It is surprisingly done on purpose! (reference) Yet new release of Guava will be available soon, with of course resolve issue. For now, excluding as stated above should work perfectly.