0

I work on a small android project that uses the unity-clases.jar generated by Unity. Some (not all) of the files/classes in the .jar can't be resolved when compiling the android project and I don't understand why.

I've unzipped the .jar files, it contains these files : enter image description here

I ran the javap utility on some of these files, they are generated with java 17, and they all have a strange warning "Warning: File ./Xxxx.class does not contain class Xxxx" that I don't understand because each Xxxx.class file actually contains the definition of the class Xxxx, as shown by the same utility javap output. See example below with class "IUnityPlayerLifecycleEvents". enter image description here

When I try to compile my android project, I get this kind of Unresolved reference errors : enter image description here

When I open the project on Android Studio (Narwhal), I can see that some of the classes defined in the unity-classes.jar are recognized, and some are not. Here is an example screenshot of a kotlin file in Android Studio. enter image description here

When I try to autocomplete com.unity3d.player on Android Studio, I can see the list of classes in unity-classes.jar that are recognized, see screenshot below. enter image description here

Something else I don't understand, when displaying one of the recognised unity-classes.jar classes in Android Studio (via right click and "go to definition"), it says it's java 8 bytecode. But when unzipping my self the unity-classes.jar files and opening the same file/class in Android Studio, it says it is java 17 bytecode (consistent with javap utility output previously seen). See screenshots below. enter image description here enter image description here

1
  • the classes of unit-classes.jar is compiled with a before version of java. You have to get the version of java for compile correctly Commented Oct 9 at 23:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.