Android生成签名Apk错误

我试图第一次从 android studio生成apk.我得到了以下错误.

Error:Execution failed for task ':_3dRunAdventure:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/unity3d/ads/android/BuildConfig.class

《Android生成签名Apk错误》

请帮我上传我的第一个安卓游戏:)

最佳答案 如果您使用Unity构建游戏,则无需将其移至Android Studio以构建apk,您可以直接从Unity构建游戏.

您所要做的就是进入文件>构建设置确保您已将平台切换到android并按下构建按钮.如果您有任何错误,Unity会告诉您它们是什么.

还要确保所有场景都添加到构建中

《Android生成签名Apk错误》

对于那些真的想继续使用android studio并出现此错误的人:

因此,与此相关的错误是一个已修复的错误,因此我首先将Android Studio更新到最新版本.

错误报告here中描述了此错误的原因:

The issue is that both the multidex library and the multidex-instrumentation library both use the same package name in their manifest which in turn means that they both have BuildConfig created in the same package name which triggers a conflict when both are added.

请注意,此特定错误位于不在android中的multidex包中.

但它几乎意味着你有两个导致冲突的相同.

This是在Unity论坛上提出的类似问题,其中包含一些解决问题的方法.

点赞