This question already has an answer here:
- How can I add a JAR in my gradle project? 2 answers
I'm having a terrible time adding an external JAR to my gradle project in Android Studio. I asked a similar question here but those answers haven't worked for me.
I created a libs
folder and added my JAR in there:
~/android/MyProject/libs $ pwd
/Users/me/android/MyProject/libs
~/android/MyProject/libs $ ls
TestFlightLib.jar
And I added the following in my build.gradle
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
After doing all this I clicked Build -> Rebuild
project but that still doesn't let me add import com.testflightapp.lib.TestFlight
I also tried the second solution of right clicking TestFlightLib.jar
and adding it as a Module. This lets me add import com.testflightapp.lib.TestFlight
successfully but when I Run
the project I still get the error: Gradle: error: package com.testflightapp.lib does not exist
What am I doing wrong?
How can I simply add an external JAR to my gradle project?