简体   繁体   中英

How do I use a class from an imported jar file in Android Studio

I imported a jar file that I created with Eclipse to my Android Studio library but I don't know how to use the classes from it. Imported it here and I'm now trying to use the logarithm class

I tried to somehow get it with the import word on the beginning of a class but I don't get it to work. Sorry I'm a beginner. :p

Ok follow this:

  1. Put the .jar into the libs folder
  2. Put compile files('libs/your.jar') is in your build.gradle file (or compile fileTree(dir: 'libs', include: '*.jar') if you are using many jar files)
  3. Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed gradlew clean. If this does not work then use the terminal tab and do this: gradlew clean .

    Hope it helps!!!

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