gpt4 book ai didi

java - 无法合并Dex

转载 作者:行者123 更新时间:2023-12-01 16:46:47 26 4
gpt4 key购买 nike

每当我尝试重新构建或运行我的代码时,都会出现以下错误:错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”执行失败。

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

我检查了很多解决方案,但没有一个解决这个问题。以下是链接。 Unable to Merge Dex - Android Studio 3.0

使用堆栈树运行 gradle 控制台出现 4 个错误:

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

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

  3. 错误:com.android.builder.dexing.DexArchiveMergerException:无法合并 dex

  4. 错误:com.android.dex.DexException:多个 dex 文件定义 Landroid/arch/lifecycle/LiveData;

使用调试选项运行给出:

Error:10:49:47.799 [ERROR] [system.err] Note: Some input files use or override a deprecated API. 10:49:47.799 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details. 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception. 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try: 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 10:50:01.875 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 1m 7s

请帮忙,我正在使用 Firebase 制作聊天应用。我被困在这里两天了,无法继续。

我的(build.gradle)文件。

    apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.imalok.saapchat"
minSdkVersion 21
targetSdkVersion 27
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'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.firebaseui:firebase-ui-database:2.3.0'
implementation 'id.zelory:compressor:2.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-storage:11.0.4'

androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

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

构建.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

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


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

allprojects {
repositories {
google()
jcenter()
}
}

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

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.imalok.saapchat">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application

android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".StartActivity" />
<activity
android:name=".RegisterActivity"
android:parentActivityName=".StartActivity" />
<activity
android:name=".LoginActivity"
android:parentActivityName=".StartActivity" />
<activity android:name=".SettingsActivity" />
<activity
android:name=".StatusActivity"
android:parentActivityName=".SettingsActivity" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
<activity
android:name=".UsersActivity"
android:parentActivityName=".MainActivity" />
<activity android:name=".ProfileActivity"></activity>
</application>

编辑:1你们会删除重复的关卡吗?正如我发布的那样,我的问题不同,解决方案也不同。

最佳答案

transform dex合并问题一直存在..直到我添加了依赖项::
实现'android.arch.lifecycle:extensions:1.1.0'

关于java - 无法合并Dex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49042566/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com