I want to add external library https://github.com/foursquare/foursquare-android-oauth to my Android application (I use Android Studio, the instructions provided by lib autho
Turn any github project into a single line gradle implementation with this website
https://jitpack.io/
Example, I needed this project: https://github.com/mik3y/usb-serial-for-android
All I did was paste this into my gradle file:
implementation 'com.github.mik3y:usb-serial-for-android:master-SNAPSHOT'
I had the same problem. This happened because of core library dependency. I was using javax.* . This is what i did to fix
In File->Project Structure->Dependencies I added this as as provided file, not a compile. Then re build the project.
This problem started after upgrade of android studio. But I think it happens when you try to edit you build files manually.
There are two simplest ways if one does not work please try the other one.
build.gradle
file of the library you are using, and paste your library in External Libraries.OR
libs
folder inside app
folder and paste all your .jar
e.g Library files there, Now the trick here is that now go inside settings.gradle
file now add this line include ':app:libs'
after include ':app'
it will definitely work.I had also faced this problem. Those time I followed some steps like:
File > New > Import module > select your library_project. Then include 'library_project'
will be added in settings.gradle
file.
File > Project Structure > App > Dependencies Tab > select library_project. If library_project
not displaying then, Click on + button then select your library_project
.
Clean and build your project. The following lines will be added in your app module build.gradle
(hint: this is not the one where classpath
is defined).
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library_project')
}
If these lines are not present, you must add them manually and clean and rebuild your project again (Ctrl + F9).
A folder named library_project
will be created in your app folder.
If any icon or task merging error is created, go to AndroidManifest
file and add <application tools:replace="icon,label,theme">
1)just get your lib from here http://search.maven.org/
2)create a libs folder in app directory
3)paste ur library there
4)right click on ur library and click "Add as Library"
5)thats all u need to do!
I hope this will definitely gonna help you!!!!
Try this:
File > Project Structure > Dependencies Tab > Add module dependency (scope = compile
)
Where the module dependency is the project library Android folder.