Is there a way to specify Android *.apk files build location other than ../build/apk/ ? Is it possible to specify different location for each flavour?
I am using Android Studio.
thats work for me:
android.applicationVariants.all { variant ->
def outputName = // filename
variant.outputFile = file(path_to_filename)
}
but "clean" task will not drop that apk, so you should extend clean task as below:
task cleanExtra(type: Delete) {
delete outputPathName
}
clean.dependsOn(cleanExtra)
full sample:
apply plugin: 'android'
def outputPathName = "D:\\some.apk"
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
applicationVariants.all { variant ->
variant.outputFile = file(outputPathName)
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
task cleanExtra(type: Delete) {
delete outputPathName
}
clean.dependsOn(cleanExtra)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.