Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by fisyher84 · Apr 16, 2012 at 03:13 AM · androidjavajarextend

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

http://unity3d.com/support/documentation/Manual/Android-Launch%20an%20Android%20Application%20from%20a%20Unity%20Application.html

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image febinmathew · Jul 14, 2017 at 05:37 PM 0
Share

How do we do this for projects in Android Studio ?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges