【问题标题】:InApp Messaging ErrorInApp 消息错误
【发布时间】:2018-08-17 06:24:29
【问题描述】:

它给了我无法合并 dex 错误。如果我评论 InApp Messaging 的依赖关系,那么它工作正常。

错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并dex

    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.1'

类路径'com.google.gms:google-services:4.0.0'

类路径'com.android.tools.build:gradle:3.0.1'

如果有任何可用的解决方案,请告诉我。

【问题讨论】:

    标签: android firebase firebase-in-app-messaging


    【解决方案1】:

    转到:ProjectFolder->.idea->libraries->全部删除

    然后构建->项目->重建

    【讨论】:

    • 发布您的 build.gradle 依赖项。您的 gradle 文件中可能存在一些冲突。
    【解决方案2】:

    类路径'com.android.tools.build:gradle:3.1.4'

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.firebasedatabasedemo"
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.google.firebase:firebase-core:16.0.1'
        implementation 'com.google.firebase:firebase-database:16.0.1'
        implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'
    
    
    }
    apply plugin: 'com.google.gms.google-services'
    

    通过将 gradle 依赖更改为 3.1.4 版本并通过集成 multidex 来解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-18
      • 1970-01-01
      • 1970-01-01
      • 2014-03-25
      • 2012-06-09
      • 2021-04-20
      相关资源
      最近更新 更多