Skip to content

Instantly share code, notes, and snippets.

@qrtt1
Last active May 19, 2020 16:09
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save qrtt1/25a44fa29e46a5ec7f5b to your computer and use it in GitHub Desktop.
Save qrtt1/25a44fa29e46a5ec7f5b to your computer and use it in GitHub Desktop.
gradle: package *.jar into aar
project.afterEvaluate {
def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
if(isAndroidLibraryProject) {
task copyDeps(type:Copy) {
from configurations.compile {
include '**/*.jar'
}
into "./build/intermediates/bundles/release/libs/"
}
bundleRelease.dependsOn copyDeps
task copyDebugDeps(type:Copy) {
from configurations.compile {
include '**/*.jar'
}
into "./build/intermediates/bundles/debug/libs/"
}
bundleDebug.dependsOn copyDebugDeps
}
}
apply plugin: 'com.android.library'
apply from: 'https://gist.githubusercontent.com/qrtt1/25a44fa29e46a5ec7f5b/raw/6dd82dd03f8386c40e41e4d0721c4b7dff88577f/aar-deps.gradle'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment