- Home /
Extending the UnityPlayerActivity Java Code fail to build
Hello Guys,
I'm trying to follow the instructions mentioned in this link to extend the UnityPlayerActivity in Android studio and use my new custom activity from unity C#,
The problem is that when i build the project i get this error:
Execution failed for task ':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 Lbitter/jnibridge/JNIBridge$a;
How to fix this error, any help is appreciated. Thanks.
Answer by Omar47i · Jan 10, 2018 at 01:41 PM
Answering my own question,
After struggling for two days i found the answer.
Unity adds its own classes automatically to the project when building the application. If you bundle them with your library, they will get added twice, I resolved this issue by using "exclude" and "provided" configurations in build.gradle
For a complete explanation for this problem see this link: https://stackoverflow.com/questions/34532008/error-building-android-library-for-unity-3d-5-3-android-studio
Your answer
Follow this Question
Related Questions
How do I override an Android Java class in Unity? 1 Answer
How to get Application.PersistentDataPath inside a Java Android Plugin 1 Answer
How to extend UnityPlayerActivity 0 Answers
Android Plugin with AppCompat Theme 2 Answers
When update android project from 2017 to 2018, I can't build it anymore 0 Answers