So there seems to be a few threads that attempt to explain how to add .zip files to android studio but I am making no progress. I am migrating from eclipse so perhaps that is why I am so incompetent in figuring out how to perform this task. Can someone please explain how to add external libraries to Android Studio v1.0.1? In eclipse it was simply importing jar/zip and done.
-
1What have you already tried? What have you read and followed what directions to do so? This appears to be more of a question to Google than to post here. At a minimum, please explain more about where and how you are stuck. – Makyen Jan 04 '15 at 23:11
-
Why add a zip to your app? What is the zip? This sounds like it will bloat your application. – Jared Burrows Jan 04 '15 at 23:38
-
http://stackoverflow.com/questions/16614177/how-to-add-parse-to-an-android-studio-project – dave Jan 04 '15 at 23:40
-
sorry the above link is what I have tried, in eclipse I would simply make a libs folder and then import and libraries necessary. I want to do something similar but I dont understand how the modules and gradle are used in android studio. Also, when I make a libs folder what type of folder do I make for resources to be accessed? – dave Jan 04 '15 at 23:41
3 Answers
I was in the same situation, trying to integrate Parse 1.8 with Android Studio 1.0.2.
On Parse's instruction page, it simply tells you to import the library into Android studio, which isn't too detailed. Here is how I solved this problem.
- Choose to import from a "Non Android Studio Project", right when Android Studio starts.
- When it asks you to choose the project, give the path, on Windows e.g.C:/path/to/parsesdk/. On *nix systems, it should be to where you have extracted to it, /home/user/path/to/parsesdk.
- After you choose the path, Android Studio will import the project accordingly.
- Click on the Application root folder (the top most folder in the folder hierarchy to the left), right click > New > Package > and add it under the src folder, name is libs.
- Copy paste the jar to the libs folder (I only copied the jar file, as I didn't need the other extra material)
- Right click on the jar, there should be an option labeled as "Add as library" towards the bottom, click on that.
Android Studio will automatically add the following to the build.gradle file.
compile files('src/libs/Parse-1.8.0.jar')
- Once the above step is completed, click on File > Project Structure. On the left, there should be a section called "Modules", click on the "Dependencies" tab on the top.
- Click the green "+" sign > Module Dependency
- Select the module from the list.
Last thing, in the build.gradle file for the "ParseStarterProject" module, if there is a red line under the classpath, change it to the following
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
After completing this step, I was able to successfully build the app.
Hope this helps :)

- 70
- 8
-
-
And youre referring to the parse starter project correct? Not just the parse SDK? – dave Jan 05 '15 at 18:21
-
Yes, this is with regards to the Parse starter project, which comes from the SDK that you download from their website. – redVaryant Jan 05 '15 at 19:41
-
Cool, I'm glad that you were able to figure it out. Could you check my answer as correct? That would help out others who might also be having this issue. – redVaryant Jan 05 '15 at 22:29
If you are using gradle with android studio (which is the preferred way now) you can include jars in a folder using this code snipet from my build.gradle.
buildscript {
repositories {
flatDir { dirs 'c:\\path\\to\\folder' }
mavenCentral()
}
}
Or by including a single file in depencies like below.
dependencies {
compile fileTree(dir: 'a-folder-in-root-of-project', include: 'a_jar.jar')
}

- 20,677
- 15
- 82
- 117
-
So do I want to make a new folder in the project and then add the classpath to the gradle for my project to be able to use the resources? – dave Jan 04 '15 at 23:38
-
This is the only way it worked for me :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//Parse
compile 'com.parse.bolts:bolts-android:1.+'
compile files('libs/Parse-1.9.2/Parse-1.9.2.jar')
compile files('libs/Parse-1.9.2/ParseCrashReporting-1.9.2.jar')
compile files('libs/Parse-1.9.2/ParseFacebookUtilsV3-1.9.2.jar')
compile files('libs/Parse-1.9.2/ParseFacebookUtilsV4-1.9.2.jar')
compile files('libs/Parse-1.9.2/bolts-android-1.2.0-javadoc.jar')
compile files('libs/Parse-1.9.2/bolts-android-1.2.0.jar')
}
OR
//Parse
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs/Parse-1.9.2', include: 'Parse-*.jar')
compile fileTree(dir: 'libs/Parse-1.9.2', include: 'ParseCrashReporting-*.jar')

- 12,778
- 14
- 93
- 110