生成带签名的APK错误:将字节码转换为dex和另外1个错误 [英] Generate Signed APK Error: Error converting bytecode to dex and 1 more

查看:99
本文介绍了生成带签名的APK错误:将字节码转换为dex和另外1个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我清理/重建项目甚至运行应用程序时,它不会返回任何错误.但是,当我生成签名的APK时,它将返回两个错误.

When I Clean/Rebuild my project or even run app, It doesn't return any errors. But when I generate signed APK, It returns two errors.

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzox;

还有这个

    Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzd.class

下面是build.gradle文件中的代码.

apply plugin: 'com.android.application'


android {
    compileSdkVersion 24
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.wildlife.dbd"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 10
        versionName "2.2.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

dependencies
{
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'

    // FB Ads
    compile 'com.facebook.android:audience-network-sdk:4.10.0'

    // Analytics
    compile 'com.google.android.gms:play-services-analytics:9.0.0'
}

推荐答案

Facebook受众网络也将引入播放服务,因此您必须将其排除在外:

Facebook audience network will pull in play-services as well, so you'll have to exclude it:

我不太清楚Facebook的依赖关系是什么,因此您的分析"行可能不够完整,无法使受众网络正常运行.您可能要像这样添加整个播放服务:compile 'com.google.android.gms:play-services:9.2.1',并删除分析.

I don't remember exactly what Facebook's dependencies are, so your 'analytics' line might not be complete enough for the audience network to run properly. You might want to add the entire play services like so: compile 'com.google.android.gms:play-services:9.2.1', and remove analytics.

或者,如果您可以确切了解Facebook需要哪些依赖项,则可以在此处获取正确的依赖项.

Or if you can see exactly which dependencies Facebook requires, you can grab the correct ones here.

compile ('com.facebook.android:audience-network-sdk:4.10.0') {
    exclude group: 'com.google.android.gms'
}

这篇关于生成带签名的APK错误:将字节码转换为dex和另外1个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆