Skip to content

Instantly share code, notes, and snippets.

@WanghongLin
Last active August 29, 2015 14:13
Show Gist options
  • Save WanghongLin/b6d4f73800415ae076a4 to your computer and use it in GitHub Desktop.
Save WanghongLin/b6d4f73800415ae076a4 to your computer and use it in GitHub Desktop.
add android framework library in android studio
buildscript {
repositories {
flatDir { dirs '../FrameworkJars' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'android'
// self-defined providedCompile
configurations {
providedCompile
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
providedCompile files('../FrameworkJars/classes.jar')
}
// for android project
android.applicationVariants.all {
variant -> variant.javaCompile.classpath += configurations.providedCompile
}
// for standard java project
// sourceSets.main.compileClasspath += configurations.providedCompile
// sourceSets.test.compileClasspath += configurations.providedCompile
// sourceSets.test.runtimeClasspath += configurations.providedCompile
// another solution for android project
android.libraryVariants.all { variant ->
variant.outputs.each { output ->
output.packageLibrary.exclude('libs/someLib.jar')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment