skip to Main Content

I had been trying to add Firebase in-app messaging into our android project. It builds successfully but when i run the app in emulator/device it throws the following error.

com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/gowthamraj/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/89507701249388e1ed5ddcf8c41f4ce1be7831ef/guava-20.0.jar
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
    at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:405)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
    at sun.reflect.GeneratedMethodAccessor1162.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:59)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:130)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:210)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:140)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:115)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
    at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:62)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:49)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at ...org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
    at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:124)
    at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:101)
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:895)
    ... 6 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:65)
    at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:43)
    at com.android.tools.r8.D8.run(D8.java:90)
    at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:99)
    ... 7 more
Caused by: com.android.tools.r8.utils.AbortException: Error: Type com.google.common.collect.MapMakerInternalMap$WeakValueReference is referenced as an interface from `com.google.common.collect.MapMakerInternalMap$WeakValueReferenceImpl`.
    at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:116)
    at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:74)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:59)
    ... 10 more

AGPBI: {"kind":"warning","text":"InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annotations are ignored.","sources":[{}],"tool":"D8"}
:app:transformClassesWithDexBuilderForDebug FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/gowthamraj/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/89507701249388e1ed5ddcf8c41f4ce1be7831ef/guava-20.0.jar

BUILD FAILED in 28s

This is my build.gradle file

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


repositories {
    maven { url 'https://maven.fabric.io/public' }
    jcenter()

}

android {
    buildToolsVersion "28.0.3"
    signingConfigs {
        signingConfigs {
            keyAlias 'betaKey'
            keyPassword 'password'
            storeFile file('./signing/app-beta.jks')
            storePassword 'password'
        }
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.pulsedin.android"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 8
        versionName "1.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [appPackageName: "${applicationId}"]
        buildConfigField("boolean", "logging_enabled", "${log_enabled}")
        buildConfigField("String", "log_prefix", ""${log_prefix}"")
        buildConfigField("String", "client_id", "${client_id}")
        buildConfigField("String", "client_secret", "${client_secret}")
        buildConfigField("String", "grant_type", "${grant_type}")
        buildConfigField("String", "scope_institution", "${scope_institution}")
        buildConfigField("String", "scope_physician", "${scope_physician}")
        buildConfigField("String", "scope_public", "${scope_public}")
        buildConfigField("String", "refresh_token_grant_type", "${refresh_token_grant_type}")
    }
    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            applicationIdSuffix ".debug"
            resValue("string", "app_name", "${app_name_debug}")
            buildConfigField("String", "app_name", ""${app_name_debug}"")
            buildConfigField("String", "api_host_name", "${dev_api_host_name}")
            buildConfigField("String", "api_host_namev2", "${dev_api_host_namev2}")
        }
        beta {
            debuggable false
            minifyEnabled false
            applicationIdSuffix ".beta"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            resValue("string", "app_name", "${app_name_beta}")
            buildConfigField("String", "app_name", ""${app_name_beta}"")
            buildConfigField("String", "api_host_name", "${beta_api_host_name}")
            buildConfigField("String", "api_host_namev2", "${beta_api_host_namev2}")
            // Added because library modules
            // does not have beta, gamma build type
            matchingFallbacks = ['debug', 'gamma', 'release']
            signingConfig signingConfigs.signingConfigs
        }
        gamma {
            debuggable false
            minifyEnabled false
            applicationIdSuffix ".gamma"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            resValue("string", "app_name", "${app_name_gamma}")
            buildConfigField("String", "app_name", ""${app_name_gamma}"")
            buildConfigField("String", "api_host_name", "${gamma_api_host_name}")
            buildConfigField("String", "api_host_namev2", "${gamma_api_host_namev2}")
            // Added because library modules
            // does not have beta, gamma build type
            matchingFallbacks = ['debug', 'beta', 'release']
        }
        release {
            debuggable false
            minifyEnabled true
            applicationIdSuffix ".release"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            resValue("string", "app_name", "${app_name_release}")
            buildConfigField("String", "app_name", ""${app_name_release}"")
            buildConfigField("boolean", "logging_enabled", "${log_disabled}")
            buildConfigField("String", "api_host_name", "${production_api_host_name}")
            buildConfigField("String", "api_host_namev2", "${production_api_host_namev2}")
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        checkReleaseBuilds false
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:appcompat-v7:${android_support_lib_version}"
    implementation "com.android.support:support-v4:${android_support_lib_version}"
    implementation "com.android.support:recyclerview-v7:${android_support_lib_version}"
    implementation "com.android.support:cardview-v7:${android_support_lib_version}"
    implementation "com.android.support:design:${android_support_lib_version}"
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    configurations.all {
        exclude group: 'com.android.support', module: 'support-v13'
    }
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }

    // Youtube player
    implementation files('libs/YouTubeAndroidPlayerApi.jar')

    // Matisse - image, video picker
    implementation 'com.zhihu.android:matisse:0.5.1'

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

    // Butterknife
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    // Nucleus
    implementation 'info.android15.nucleus5:nucleus:7.0.0'
    implementation 'info.android15.nucleus5:nucleus-support-v4:7.0.0'
    implementation 'info.android15.nucleus5:nucleus-support-v7:7.0.0'

    // RxJava2 and RxAndroid
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'

    // Because RxAndroid releases are few and far between, it is recommended you also

    // explicitly depend on RxJava's latest version for bug fixes and new features.
    implementation 'io.reactivex.rxjava2:rxjava:2.1.14'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'

    // Retrofit - RxJava call adapter
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'

    // Retrofit gson converter
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    // Okhttp logging interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    // Easy Permissions
    implementation 'pub.devrel:easypermissions:1.3.0'

    // Photo View - Image zoom
    implementation 'com.github.chrisbanes:PhotoView:2.1.3'

    // Otto - Event Bus
    implementation 'com.squareup:otto:1.3.8'

    // Joda time
    implementation 'joda-time:joda-time:2.9.9'

    // Picasso - Image loading
    implementation 'com.squareup.picasso:picasso:2.71828'

    // Apache commons - Text
    implementation 'org.apache.commons:commons-text:1.4'

    // Multidex
    implementation 'com.android.support:multidex:1.0.3'

    // Facebook SDK
    implementation 'com.facebook.android:facebook-android-sdk:4.22.0'

    // Firebase messaging
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    // Google play services
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    // Google People API
    implementation 'com.google.apis:google-api-services-people:v1-rev2-1.21.0'

    // File upload service
    implementation 'net.gotev:uploadservice:3.4.2'
    implementation 'net.gotev:hostmonitor:2.0@aar'

    // Jsoup - HTML Parsing
    implementation 'org.jsoup:jsoup:1.10.2'

    // Exo player - For video playing
    implementation 'com.google.android.exoplayer:exoplayer:2.7.0'

    // Image crop,rotate library
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
    //Get pdf Path
    implementation 'com.nbsp:library:1.8'

    // MultiType-FilePicker
    implementation 'com.vincent.filepicker:MultiTypeFilePicker:1.0.8'
    // Local Library modules
    implementation project(':text-editor')
    implementation project(':linkedin-sdk')
    implementation project(':mentions')

    // Add the In-App Messaging dependency:
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.4'

    // Check that your Firebase dependency is up-to-date:
    implementation 'com.google.firebase:firebase-core:16.0.5'
}

//Firebase
apply plugin: 'com.google.gms.google-services'

Project level Gradle File:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        // FCM
        classpath 'com.google.gms:google-services:4.0.1'
    }
}



allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://repo.adobe.com/nexus/content/repositories/releases/'
        }
        maven {
            url 'http://maven.localytics.com/public'
        }
        maven {
            url 'https://jitpack.io'
        }
        maven {
            url  "http://dl.bintray.com/lukaville/maven"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

task indexAssets {
    description 'Index Build Variant assets for faster lookup by AssetManager'

    ext.assetsSrcDir = file("${projectDir}/src/main/assets")

    inputs.dir assetsSrcDir

    doLast {
        android.applicationVariants.each { target ->
            // create index
            def contents = ""
            def tree = fileTree(dir: "${ext.assetsSrcDir}", include: ['**/*.ttf'], exclude: ['**/.svn/**', '*.index'])
            // use this instead if you have assets folders in each flavor:
            // def tree = fileTree(dir: "${ext.variantPath}", exclude: ['**/.svn/**', '*.index'])
            tree.visit { fileDetails ->
                contents += "${fileDetails.relativePath}" + "n"
            }

            // create index file
            def assetIndexFile = new File("${ext.assetsSrcDir}/assets.index")
            assetIndexFile.write contents
        }
    }
}

indexAssets.dependsOn {
    tasks.matching { task -> task.name.startsWith('merge') && task.name.endsWith('Assets') }
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn indexAssets
}

3

Answers


  1. Chosen as BEST ANSWER

    After a lot of struggle and a hundreds of failed attempt we were able to solve the issue. Also after a wasted bounty :(. The solution of the issue was not multidex. The issue was the guava-jdk5 being used by both Firebase In-App Messaging and the Picasso library. Upon adding the following and downgrading the Picasso library to 2.5.2 we were able to solve it.

    // Google People API
    implementation('com.google.apis:google-api-services-people:v1-rev2-1.21.0')
    {
        exclude module: 'guava-jdk5'
    }
    implementation 'com.squareup.picasso:picasso:2.5.2'
    

    Hope the future Googlers will find this helpful.


  2. Try to add guava dependency in the app level build.gradle file which makes the build tools to use the latest version of android compatible guava.

    dependencies {
    
        implementation('com.google.firebase:firebase-messaging:17.3.4') {
            exclude group: 'com.google.guava'
        }
    
        api 'com.google.guava:guava:27.0-android'
    }
    
    Login or Signup to reply.
  3. in this case, it’s not the dreaded guava – it just cannot be added into the classes.dex

    since you have minSdkVersion 16 …you need to add a dependency for the multidex library:

    dependencies {
        // implementation "com.android.support:multidex:1.0.3"
        implementation "androidx.multidex:multidex:2.0.0"
    }
    

    this is because of the 64k limit:

    Versions of the platform prior to Android 5.0 (API level 21) use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK.

    any other issues with that build.gradle, just leave a comment below.

    edit: to generally exclude guava-jdk5, which may come from some age-old library:

    configurations.all() { configuration ->
        exclude group: "com.google.guava", module :"guava-jdk5"
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search