I am trying to add a library, https://github.com/edmodo/cropper, to my Android project. I am following the methods described here: How do I add a library project to Android Studio?
but the Android Studio has changed since then and I can no longer "Import a Module". I can only add a new one. Here are the steps I have tried:
Copy the library into a folder named libraries.
Open Module Settings, and I am presented with this screen
I click the + sign to add a new module and am then presented with this screen
I choose to fill in the content root
The rest of the fields autofill to this
The next step...
I change the package
I hit next and now my project looks like this
Any idea on the correct way to add an external library in Android Studio 0.3.6+?
I don't use the wizard. Usually I edit the gradle files.
Create a structure like this:
- Blunka
build.gradle
- cropper
build.gradle
src
res
settings.gradle
In settings.gradle:
include ':Blunka', ':cropper'
In cropper/build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion XX
targetSdkVersion 19
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
In Blunka/build.gradle add:
dependencies {
// Libraries
compile project(':cropper')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With