To create a libary , you should use File -> New -> New Module -> Android Library
. This will create a basic library project.
When that's done, you must have a project that is set up the following manner:
[project root directory]
[library root directory]
[gradle]
build.gradle //project level
gradle.properties
gradlew
gradlew.bat
local.properties
settings.gradle //this is important!
Your settings.gradle
file must contain the following:
include ':[library root directory]'
Your [library root directory]
must contain the following:
[libs]
[src]
[main]
[java]
[library package]
[test]
[java]
[library package]
build.gradle //"app"-level
proguard-rules.pro
Your "app"-level build.gradle
file must contain the following:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
}
}
With that, your project should be working fine!