- Home /
Got stuck trying to extend UnityPlayerActivity following example in Unity documentation.
I am following the example for Extending UnityPlayerActivity in the official guide: http://unity3d.com/support/documentation/Manual/Android-Plugins.html but I got stuck at the following sentence:
"Then add classes.jar to the classpath used to compile the new Activity."
I am a complete Java beginner so I do not understand the steps needed to do this. I am currently developing an Unity Android application on a Windows 7 PC. I am trying to extend UnityPlayerActivity to a customised one so that I can start another activity from this activity like in the example given in
What are the detailed steps needed to compile the newly created activity and add the classes.jar to a new .jar? Is this question even correct? I got lost after searching for answer to these steps on Google for hours. I figure maybe someone more experienced can provide an answer much faster here.
Answer by Paulius-Liekis · Apr 17, 2012 at 10:15 AM
"Then add classes.jar to the classpath used to compile the new Activity."
This sentence means that you need to add a reference to classes.jar to compile arguments when compiling your java classes. classes.jar file is located in Unity Editor subfolders. I assume you're doing something like this to compile your activity:
javac MyActivirty.java -d .
You need to classes.jar to that:
javac MyActivirty.java -classpath /Path/To/Classes/Jar/classes.jar -d .
If you need to add extra jars to classpath, you have to separate them using ":" symbol:
javac MyActivirty.java MyOtherClass.java -classpath /Path/To/Classes/Jar/classes.jar:/AnotherPath/another.jar -d .
If you need to add Android java classes add bootclasspath argument:
javac MyActivirty.java MyOtherClass.java -bootclasspath /Path/To/AndroidSDK/android-sdk-mac_86/platforms/android-11/android.jar -classpath /Path/To/Classes/Jar/classes.jar:/AnotherPath/another.jar -d .
I hope this will get you going.
Your answer
Follow this Question
Related Questions
Read NFC tag from Unity3d android 1 Answer
I need add .jar project Unity -1 Answers
Extending the UnityPlayerActivity Java Code fail to build 1 Answer
How do I use Java callbacks? 1 Answer
Calling static jar function from Unity3D 0 Answers