Closed ivanmayes closed 5 years ago
Is there a unity-classes.jar or something similar in UnityProject in Android Studio?
Yes, that was the issue. Both the android project and the UnityProject had a unity-classes.jar
file.
I had to remove the unity-classes.jar
from the android project in the lib
folder, then go to my UnityProject to the lib
folder, right-click the unity-classes.jar
file and select 'Add as Library'. Then select android
as the project to add the library to.
Hello there,
I still have this problem. Following the instructions of @ivanmayes did not solve the problem.
I deleted the file unity-classes.jar
located in the android module, and added as a library the one located in the Unity project. It automatically added the following line in my bundle.gradle file:
implementation files('/Users/MyUser/Developer/Cordova/hello/platforms/android/Unity/libs/unity-classes.jar')
But still did not work. I tried changing the previous line by the following hoping a different result:
compile fileTree(dir: '/Users/MyUser/Developer/Cordova/hello/platforms/android/Unity/libs', include: ['*.jar'])
But the result was the same. I did the process "manually" from File, Project Structure. Neither did work. I also tried with both Cordova and Ionic, exactly the same error in both:
error: package com.unity3d.player does not exist
error: cannot find symbol class UnityPlayer
I have no idea what to try next. So any clue will be really appreciated.
This is me again! It is working now.
In bundle.gradle file of app module, instad of:
compile project(':UnityProject')
I am using:
implementation project(':UnityProject')
Which is the same thing Cordova actually does:
implementation project(path: ':CordovaLib')
Then, the unity-classes.jar file was implemented in the same way:
implementation files('../Unity/libs/unity-classes.jar')
So the result is something like this:
dependencies {
// SUB-PROJECT DEPENDENCIES START
implementation project(path: ':CordovaLib')
// SUB-PROJECT DEPENDENCIES END
implementation project(':UnityProject')
implementation files('../Unity/libs/unity-classes.jar')
}
And for some reason and no idea why since the unity-classes.jar is already implemented in the main module, I needed to do the same implementation for bundle.gradle file of Unity module. So just at the end of the file, the following:
dependencies {
implementation files('libs/unity-classes.jar')
}
All this is Using Cordova 8.1.2 (cordova-lib@8.1.1) and Unity 2019.1.
Thank you @yasirkula for such an awesome work. Now I need to implement the same on iOS.
Hey all! When I try to build on a clean project after adding the ionic plugin from the tutorial, this is the error log I get. Not sure what I can do to solve it. Do I need to be on a older gradle version?