I am using the mac version of android studio 1.2 Beta 2, built on April 7, 2015. Gradle version 2.2.1 and Gradle plug-in version 1.1.0.
After I create a new project, The following code exist by default in my app/build.gradle file.
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
It means that any jar file I add to the app/libs directory should be loaded to my project, right? However, when I add my Parse-1.9.0.jar to the app/libs, it is not loaded. I failed to use the code from the API in MainActivity.java.
I got it working by right click Parse-1.9.0.jar -> Add As Library... The app/build.gradle became:
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/Parse-1.9.0.jar')
}
I am confused of why. Shouldn't compile fileTree() include all the jar files? Why do I need to do the additional step?
The Parse-1.9.0.jar file I downloaded is from: https://parse.com/apps/quickstart#parse_data/mobile/android/native/existing
Thanks
compile files('libs/Parse-1.9.0.jar')
when there is alreadycompile fileTree(dir: 'libs', include: ['*.jar'])
in place – Handbreadth