How do I add a library project (such as Sherlock ABS) to Android Studio?
(Not to the old ADT Eclipse-based bundle, but to the new Android Studio.)
Add this in your build gradle file:
dependencies {
implementation 'com.jakewharton:butterknife:9.0.0'
}
Here is the visual guide:
Update for Android Studio 0.8.2:
In Android Studio 0.8.2, go to Project Structure -> under Modules just hit the plus button and select Import Existing Project and import actionbarsherlock
. Then synchronise your Gradle files.
If you face the error
Error: The SDK Build Tools revision (xx.x.x) is too low. Minimum required is yy.y.y
just open the build.gradle
file in actionbarsherlock
directory and update the buildToolsVersion
to the suggested one.
android {
compileSdkVersion 19
buildToolsVersion 'yy.y.y'
Menu File -> Project Structure...:
Module -> Import Module
After importing the library module, select your project module and add the dependency:
And then select the imported module:
Indeed as versions are changing, so is changing the user interface and options available on the menu. After reading most of the answers to these questions I had to guess what would work for Android Studio 1.1.0.
With your mouse, select the project at the main level (this is where it shows the name of your app).
Right click, and select the menu options New, Folder, Assets Folder.
After creating the assets folder, paste or copy in it, whatever JAR file you need for your library.
From Android Studio's main menu (top of the screen) select File -> Project Structure.
Then select your project name and go to the Dependencies tab.
Click on the plus sign (+) on the lower left of the dialog box and select file dependency.
Finally open the recently created assets folder, select the JAR files that you copied, and then click apply and OK.
Clean and rebuild your project.
Basically, you can include your JAR files in three different ways. The last one is remote library that is using https://bintray.com/ jcenter online repository. But, if you do it in one of the two other ways, the JAR file will be included physically in your project. Please read this link https://stackoverflow.com/a/35369267/5475941 for more information. In this post I explained how to import your JAR file in Android studio and I explained all possible ways.
In summary, if it is like this (local address), they are downloaded and these JAR files are physically in the project:
But, if it is an internet address like this, they are remote libraries (bintray.com jcenter part) and they will be used remotely:
I hope it helps.
Open the build gradle module app file and add your dependency. If you download the library, just import and build as gradle.
Otherwise add repositories in side gradle module app:
repositories {
maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
}
The first repositories will download the library for you.
And compile the downloaded library:
compile ('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT@aar') {
transitive = true
}
If you are creating a library, you just need to import the project as import new module.
If you have Android Studio .0.4.0, you can create a new folder in your build path, YourApp/libraries
. Copy the JAR file. There in, right click on it and "Add As Library". Now you have a popup. Just select your directory and press OK, and that's it.