[Android] How to import library into android studio
阿新 • • 發佈:2019-02-06
Project Structure
config
- A this project will use the library
- B is SlidingMenu ‘s build.grade file
notice:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 22
}
hint: above config should be the same with the project build-tools version
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
compileSdkVersion 22
buildToolsVersion "22.0 .1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 22
}
sourceSets {
main {
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res' ]
assets.srcDirs = ['assets']
manifest.srcFile 'AndroidManifest.xml'
}
}
}
3 . C this project’s build.grade file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
4 . D is setting.grade file
include ':app'
include ':SlidingMenu-master:library'