How Do I Import "com.unity3d.player.unityplayer" Into My Android Library?
Solution 1:
I figured out exactly what is contained in these AAR files I've been importing in to Unity.
I have been doing the correct thing by including classes.jar
from Unity into my plugin/libs
. The problem was that by building my plugin in Android Studio with classes.jar
in libs
, classes.jar
was being included in the final AAR output, which on the Unity side of things is redundant because Unity already has this data, thus the duplicate classes error I've been getting.
The fix was to open the AAR is some archive editor (7-zip or winrar) and extract only the clases.jar
within that and import only that into Unity.
I'm surprised there's not more official documentation on this process.
Also, this fix means no edits to the Gradle build script is necessary unless you want to automate the copy process from intermediate builds to Unity.
Solution 2:
Change implementation
to compileOnly
for 'com.unity3d.player'
. This allows the unity player classes.jar to be used at compile time, but not at run time which was causing the duplication.
Solution 3:
Opening the unity player class after adding classes.jar file from unity in libs folder solved this issue for me.
Post a Comment for "How Do I Import "com.unity3d.player.unityplayer" Into My Android Library?"