简体   繁体   中英

Android Generate Signed Apk error

I tried to generate apk from android studio for first time. I got below error.

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

在此输入图像描述

Please help me to upload my first android game :)

If you're building your game with Unity you don't need to move it to Android Studio to build the apk, you can directly build it from Unity.

All you have to do is go in File > Build Settings make sure you've switched the platform to android and press the build button. If you have any errors Unity will tell you what they are.

Also make sure all your scenes are added to the build

在此输入图像描述


For those who really want to continue with android studio and have this error:

So an error related to this one was a bug that was fixed so I would first update Android Studio to the newest version.

The cause of this error are described in the bug report 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.

Note that this specific bug was in the multidex package not in the android.

But it pretty much means that you have two of the same which causes conflict.

This is a similar question asked on the Unity Forums which contains some ways to fix the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM