Last active
May 19, 2020 16:09
-
-
Save qrtt1/25a44fa29e46a5ec7f5b to your computer and use it in GitHub Desktop.
gradle: package *.jar into aar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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