【问题标题】:Merge Dex Issue With Android Studio将 Dex 问题与 Android Studio 合并
【发布时间】:2018-03-15 18:45:05
【问题描述】:

我的应用没有出现错误:

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

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

这是你的构建 gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "app.monmos"
    minSdkVersion 21
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
    }
    }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-   core:2.2.2', {
    exclude group:'com.android.support', module: 'support-annotations'
})

//noinspection GradleCompatible
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-         core:3.0.1'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.github.bumptech.glide:glide:4.0.0'


//Fixed Crash FButton
implementation ('com.github.jd-alexander:android-flat-button:v1.1')

//Libraries
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'


implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.google.android.gms:play-services:11.8.0'
testCompile 'junit:junit:4.12'

implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.android.support:recyclerview-v7:26.+'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'

}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 发布错误日志和代码
  • 你为什么这样做?? just copy and paste 非常糟糕非常糟糕 :(
  • 错误似乎出现在我的 gradle 和我的课程中,这就是我放置 github 配置文件的原因,以便您可以评估所有代码。
  • 'UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5' 检查 xml 中'FButton' 的属性。颜色值不是应该的:)
  • 我已经添加了按钮的颜色值,您可以帮我看一下吗?我已经尝试了所有方法,但应用程序仍然无法运行,无法继续前进。

标签: java android emulation


【解决方案1】:
implementation 'com.android.support:support-v4:26.1.0'

与:

implementation 'com.android.support:support-v13:27.1.0'

您不能拥有同一个库的 2 个版本。使用其中一种。

或者你可以在你的模块的 Build.Gradle 中添加:

android {
    ...
    defaultConfig {
        ...
        multiDexEnabled = true
    }
...
}

应该能解决问题。

让我知道结果如何。

【讨论】:

  • 是的,在点击“发布”按钮之前,请确保您的问题在预览中看起来不错。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-03
  • 1970-01-01
相关资源
最近更新 更多