0

Ok, this is going to be a really stupid question but I can't figure out a solution. So I added a .jar file to Android Studio the following way:

  • exported .jar file using IntelliJ IDEA
  • copied .jar to libs folder under app folder in the Project view in Android Studio
  • Right clicked the .jar and selected "Add as Library"

The line compile files('libs/MyJar.jar') was added to the build.gradle file. However I cannot figure out how to actually use the classes in the jar. I can't seem to import it at all, and it is as if I didn't actually add anything. What am I doing wrong?

I know this is an idiotic question, but I can't find a solution.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Soggy_Toast
  • 57
  • 1
  • 9
  • 1
    check this https://stackoverflow.com/questions/25660166/how-to-add-a-jar-in-external-libraries-in-android-studio – 1234567 Oct 21 '17 at 06:47
  • 1
    Possible duplicate of [How to use classes from .jar files?](https://stackoverflow.com/questions/460364/how-to-use-classes-from-jar-files) – Vishal Yadav Oct 21 '17 at 06:50

1 Answers1

0

If you've added the jar as you say and if gradle builds successfully after adding the jar then you can just start coding in your Activity you'll get an prompt to import the associated class file in your .jar.

Deep Lathia
  • 750
  • 7
  • 18