简体   繁体   中英

How to use your own created jar file in another android application

I created my own jar file using eclipse. Now i am trying to make an android JAR file and then will use the same JAR file in others android apps.

Now though, my application is complete and make a jar file, but how i will use it for other Android Apps?

You should be able to access any publicly exposed methods from your .jar by importing the .jar into your project, then adding

import myjar.myclass;

You can then reference any methods from the class you import.

Hope this helps!

  1. Add the jar to you build path
    • Right click project
    • Click "Properties" -> "Java Build Path" -> "Libraries"
    • Click "Add External Jar"
  2. Import classes like normal

     import com.my.package.here.MyClass; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM