Issue in adding Firebase In-App Messaging
Asked Answered
J

3

9

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
}
Jetblack answered 20/11, 2018 at 14:18 Comment(14)
Did you try clean/rebuild? I had this exact issue last week, clean/rebuild fixed it for me.Viscus
Yeah we did a clean rebuild, still same :(Jetblack
@GowthamRaj Do you get the same error for different build type? I noticed that you have proguard enabled for release build type. Can you try using minifyEnabled false for release build type and see if you are still getting the same error?Ri
I couldn't take even a debug build in debug mode itself.Jetblack
make your app multidex enabled. have a look at this ref => developer.android.com/studio/build/multidexFlavia
Maybe try removing the cache guava-20.0.jar and refresh Gradle build (to let it redownload this dependency)?Troposphere
Is the error reproduced without emulator? @GowthamRajPlattdeutsch
Yes, i tried with emulator, Google Pixel 1, One Pus 6T, Redmi 5 Pro. But i am getting the same error.Jetblack
Removing cache also didnt work out. i deleted the entire folder under /Users/gowthamraj/.gradle/caches still no luckJetblack
we have already enabled multidex, you can check that in our gradle fileJetblack
@GowthamRaj : make sure distributionUrl = https\://services.gradle.org/distributions/gradle-4.6-all.zip is with version 4.6 in your gradle.properties file.Walkthrough
Nope, not helping it... tried with gradle 4.7 too. still its a failureJetblack
Can you share the version in which you are trying to run the app?Antibiosis
I would suggest you to add multidex to your project because of max number of methods reached or either you can run your app in android versions above marshmallowAntibiosis
J
0

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.

Jetblack answered 6/12, 2018 at 6:15 Comment(2)
you're using a completely outdated version there; as the jdk5 may hint for. the current version is com.google.apis:google-api-services-people:v1-rev375-1.25.0. which does not even have that dependency: mvnrepository.com/artifact/com.google.apis/… ...the issue might nevertheless have been the missing multidex dependency (just remove it for a test), simply because else it would have complained about "program type already present". the 1.21.0 branch isn't even maintained anymore.Burnout
and Firebase In-App Messaging does not include guava-jdk5 either.Burnout
P
3

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'
}
Plumley answered 24/11, 2018 at 11:15 Comment(3)
@GowthamRaj: Have you tested it?Plumley
@GowthamRaj: In case of such issues, everybody only can make a guess to solve the problem. Because we don't access to your source code to try multiple ways. However, I'm glad to see your problem is solved by excluding guava from correct library.Plumley
Totally agreed. And i really thank you for spending some of your valuable time to help me out.Jetblack
B
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"
}
Burnout answered 30/11, 2018 at 17:17 Comment(13)
i dont think it is because of that. When i uncomment the firebase in app messaging library, I am able to build it irrespective of the multidex versionJetblack
@GowthamRaj "I don't think" probably means "you haven't tried". when reducing the amount of classes, you might get below the 64k limit with the overall count of classes in the package, so they would fit inside one single classes.dex file... which might explain this behavior in a plausible way.Burnout
Thanks a lot for spending your time. I tried it before you answered itself. it wasnt working outJetblack
@GowthamRaj I'm pretty sure it works - because what you write confirms that the 64k limit is at fault. also the error message looks quite alike. try to delete the build directories, make the project. setting minSdkVersion 22 would also make it build, without adding that dependency, because it 's ART instead of Dalvik then (which supports multiDexEnabled true by default).Burnout
the build clearly bugs out when DexArchiveBuilderTransform hits the 64k limit. and pretending it wouldn't work might only serve the purpose to cheat me for the bounty. this is not how this site works. I've provided the solution and therefore I demand the bounty.Burnout
I couldnt get it working, i am giving you the bounty. keep it... i dont want itJetblack
@GowthamRaj misread that. try to manually delete all build directories; clear caches. it simply has to work. because that it bugs out at DexArchiveBuilderTransform cannot have any other reason. shall I provide an example project on GitHub, with firebase-inappmessaging ?Burnout
Thanks! i did all these before posting the question here. Nothing helped. I am also a member in this for around 6 years and i know how stackoverflow works there is nothing to cheat here for the bounty.Jetblack
@GowthamRaj ever tried to delete /Users/gowthamraj/.gradle/caches ? that there is a corrupt file in there could be the only other reason.Burnout
One last question. I also get this in the logs.. does this strike any bell? AGPBI: {"kind":"error","text":"Type com.google.common.collect.MapMakerInternalMap$WeakValueReference is referenced as an interface from com.google.common.collect.MapMakerInternalMap$1.","sources":[{}],"tool":"D8"} AGPBI: {"kind":"error","text":"Type com.google.common.collect.MapMakerInternalMap$WeakValueReference is referenced as an interface from com.google.common.collect.MapMakerInternalMap$WeakValueReferenceImpl.","sources":[{}],"tool":"D8"}Jetblack
/Users/gowthamraj/.gradle/caches yes this is what i meant when u asked about clearing the cache filesJetblack
@GowthamRaj that D8 message is just a warning from the dexer, coming from github.com/google/guava/blob/master/guava/src/com/google/common/… ...possibly the result of the broken classes.dex; a follow-up error, from the failed transform. I can see it reads caused by ...but the error is further above. or was that a new one message?Burnout
I ran into the same issue in trying to add firestore 18.0.0 to my project. Excluding Guave jdk 5 did the trick for me. TnxEtruria
J
0

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.

Jetblack answered 6/12, 2018 at 6:15 Comment(2)
you're using a completely outdated version there; as the jdk5 may hint for. the current version is com.google.apis:google-api-services-people:v1-rev375-1.25.0. which does not even have that dependency: mvnrepository.com/artifact/com.google.apis/… ...the issue might nevertheless have been the missing multidex dependency (just remove it for a test), simply because else it would have complained about "program type already present". the 1.21.0 branch isn't even maintained anymore.Burnout
and Firebase In-App Messaging does not include guava-jdk5 either.Burnout

© 2022 - 2024 — McMap. All rights reserved.