gpt4 book ai didi

java - TransformException多个dex文件

转载 作者:行者123 更新时间:2023-12-03 05:59:54 25 4
gpt4 key购买 nike

我使用Google服务创建了一个应用,现在我想生成一个已签名的APK。但是当我尝试创建此apk时出现此错误

Error:Execution failed for task ':app:transformClassesWithDexForRelease'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzqv;



这是我的Gradle文件
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.xxx.xxx.xxx"
minSdkVersion 18
targetSdkVersion 25
versionCode 5
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile project(':BaseGameUtils')
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-games:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
testCompile 'junit:junit:4.12'
}

我已经尝试过Stackoverflow的一些解决方案,但仍然出现我的错误。

我希望你们能帮助我解决我的问题

最佳答案

尝试在build.gradle中启用multidex:

defaultConfig {
...
multiDexEnabled true
}

还添加依赖项:
dependencies {
compile 'com.android.support:multidex:1.0.0'
}

现在在您的Application类中:附加multidex
    public class MyApplication extends Application {

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

}

确保您在 list 中定义应用程序类

关于java - TransformException多个dex文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42373432/

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