yasirkula / UnityIonicIntegration

A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
104 stars 32 forks source link

Android Studio: Failed to process unity-classes.jar #54

Open abeldantas opened 5 years ago

abeldantas commented 5 years ago

Dex error while processing unity-classes.jar This is on a minimal unity project.

image

These are the unity-classes.jars I have: image

They all are where they need to be, right?

Any tips deeply appreciated.

abeldantas commented 5 years ago

The error itself is Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\user\ionic-spike\Export\UnityProject\libs\unity-classes.jar

yasirkula commented 5 years ago

I don't have Ionic installed at the moment so I can't verify your screenshot but you just need to delete android/jniLibs/unity-classes.jar. No other unity-classes.jar related action is needed.

abeldantas commented 5 years ago

No unity-classes.jar show up in any jniLibs folder, so I'm guessing this has nothing to do with duplicated unity-classes.jar. That was the suggestion on this possibly related issue: https://github.com/yasirkula/UnityIonicIntegration/issues/46

The screenshot I added above shows all the unity-classes.jar I have in the project, none of them are in a jniLibs folder.

This seems to be different. Additionally I get 2 slightly different errors each time I run the app:

Type com.unity3d.player.f is referenced as an interface from com.unity3d.player.UnityPlayer. And Type com.unity3d.player.d is referenced as an interface from com.unity3d.player.Camera2Wrapper.

To be clear, the project sync with gradle files without issues, this only happens when I try to run the app.

abeldantas commented 5 years ago

@yasirkula what gradle version and unity version are you using?

Some steps in the README are slightly different due to gradle version (like using implementation) so I want to try the same version that you're using.

I built the Unity project via Android Studio and it works. I built the ionic project with the plugin (ionic cordova plugin add https://github.com/yasirkula/UnityIonicIntegration.git) but without integrating the Unity project and it works.

What's failing is adding the unity project as a dependency.

yasirkula commented 5 years ago

For me, jniLibs directory was there while browsing the project files in Android mode. Example image:

screenshot

I can't remember my Gradle version but despite using implementation, there should be no other difference. Neither can I remember the Unity version(s), sorry. There has been quite some time since I last worked with Ionic.

If you can't find unity-classes.jar inside jniLibs, then try deleting all unity-classes.jar files except the one inside Export/UnityProject.

MichaelHuy commented 4 years ago

No unity-classes.jar show up in any jniLibs folder, so I'm guessing this has nothing to do with duplicated unity-classes.jar. That was the suggestion on this possibly related issue: #46

The screenshot I added above shows all the unity-classes.jar I have in the project, none of them are in a jniLibs folder.

This seems to be different. Additionally I get 2 slightly different errors each time I run the app:

Type com.unity3d.player.f is referenced as an interface from com.unity3d.player.UnityPlayer. And Type com.unity3d.player.d is referenced as an interface from com.unity3d.player.Camera2Wrapper.

To be clear, the project sync with gradle files without issues, this only happens when I try to run the app.

The same error to me now. Build without any errors, just show when run the app.

MichaelHuy commented 4 years ago

Oh... I solved it. 🍡

yasirkula commented 4 years ago

How did you resolve the issue?

MichaelHuy commented 4 years ago

How did you resolve the issue?

Android/app/libs and untityProject/libs folder have unity-classes.jar. Delete one. Rebuild project then I can run the app.