Unity Integration with Ionic 4 Capacitor
Hello,
I am using UnityIonicIntegration plugin with Ionic Capacitor. Now after doing all the necessary tasks mentioned at 'yasirkula/UnityIonicIntegration', Facing below error:
Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: bitter.jnibridge.JNIBridge$a
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
... 28 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at com.android.tools.r8.utils.t.a(:55)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
... 30 more
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: bitter.jnibridge.JNIBridge$a
This is because of multiple 'unity-classes.jar', 1 is present at 'capacitor-cordova-android-plugins\src\main\libs' and 2 at UnityAndroidApp\libs
Removing either one causes class not found error.
Please help me resolve this issue.
Thanks
SOLVED
Inside android studio Module Settings, Created a new module [Import .JAR/.ARR Package] added path of unity-classes.jar (Created a externalLib folder in project root and placed jar here). Now in dependencies tab, Removed unity-classes.jar from both present at 'capacitor-cordova-android-plugins\src\main\libs' and UnityAndroidApp\libs. Now declared new jar module as dependency in both the module fixed this issue.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.