当前位置: 首页 > 知识库问答 >
问题:

无法合并dex错误构建调试apk时

柳俊彦
2023-03-14

当我构建调试应用程序时,我遇到了这个问题!请帮助。

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

Java语言lang.RuntimeException:java。lang.RuntimeException:com.Android建设者德兴。DexArchiveMergerException:无法合并dex

添加"multiDexEnable true"对我不起作用

我的Gradle文件-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId 'com.test.thing'

        manifestPlaceholders = [onesignal_app_id               : "test",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
        minSdkVersion 15
        targetSdkVersion 26


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    repositories {
        jcenter()
        mavenCentral()  // GPUImage for Android
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/ormlite-core-4.43.jar')
    // If you want to use the GPU Filters

    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.google.firebase:firebase-ads:10.0.0'
    compile 'com.google.firebase:firebase-messaging:10.0.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'jp.wasabeef:glide-transformations:2.0.1'
    compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

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

`

共有2个答案

微生新翰
2023-03-14

应该启用Multidex,如果您必须显式为API启用multidex

在Gradle文件中:-像这样添加。

android {
    defaultConfig {
        multiDexEnabled true
    }
}

部门部分添加此行:-

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

在清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>

此外,确保你没有错过任何东西https://developer.android.com/studio/build/multidex.html

最后清理并构建应用程序

牛枫
2023-03-14
apply plugin: 'com.android.application'



android {

compileSdkVersion 27
defaultConfig {
    applicationId "com.taggroup.www.myapp"
    minSdkVersion 18
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {
    release {
        minifyEnabled false
        multiDexEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        multiDexKeepFile file('multidex-config.txt')
    }
      }
  } 
dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.firebase:firebase-ads:11.8.0'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.github.bumptech.glide:glide:4.2.0'
implementation 'com.android.volley:volley:1.1.0-rc1'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.firebase:firebase-core:11.8.4'
implementation 'com.github.amigold.fundapter:library:1.0'
implementation 'org.apache.httpcomponents:httpclient:4.3.5'
implementation files('./2checkout-java.jar')
}









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

在五月的情况下,我这样做,它的工作罚款和menifast文件

  <application
    android:allowBackup="true"
    android:icon="@drawable/logo_ew"
    android:label="Darzee.co"
    android:roundIcon="@drawable/logo_ew"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:label,android:icon"
    android:name="myapp">
    <activity android:name=".Starter.Loader">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

和类以添加到清单文件中

package ...........;

import android.content.Context;
import android.os.Bundle;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.support.v7.app.AppCompatActivity;

import com.google.firebase.crash.FirebaseCrash;



public class myapp extends MultiDexApplication  {
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

}
 类似资料:
  • 应用程序构建: 任何帮助都将不胜感激,因为这个项目即将到期!

  • 应用插件: 堆栈跟踪错误 失败:生成失败,出现异常。 请访问https://help.gradle.org获取更多帮助

  • 错误:无法运行“javac-version”,请确保已安装JDK。您可以从以下网站获得:http://www.oracle.com/technetwork/java/javase/downloads.您的JAVA\u主页无效:C:\Program Files\JAVA\jdk1。8.0_172

  • 应用程序分级:

  • 在Unity中生成APK时显示此错误: CommandInvokationFailure:无法合并android清单。C:/program files/java/jdk1.8.0_221\bin\java.exe-xmx4096m-dcom.android.sdkmanager.toolsdir=“C:/users/pc/appdata/local/android/android-sdk\tool

  • 这是错误 > 其中: 构建文件 'D:\Work From Office\Form\form\android\app\build.gradle' 行: 30 哪里出错:评估项目时出现问题:“app”。 格式错误的\uxxxx编码。 > 尝试:使用--stacktrac选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--search运行以获得完整的见解。 获取