From c675d238faed26faf86a55b87ee4a8b0cea25299 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Fri, 15 Apr 2016 11:44:43 -0400 Subject: [PATCH] use better apk names --- ACardEmulator/app/app.iml | 2 +- ACardEmulator/app/build.gradle | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ACardEmulator/app/app.iml b/ACardEmulator/app/app.iml index 96af714..1931a19 100644 --- a/ACardEmulator/app/app.iml +++ b/ACardEmulator/app/app.iml @@ -96,8 +96,8 @@ - + diff --git a/ACardEmulator/app/build.gradle b/ACardEmulator/app/build.gradle index 6d5f04f..a1eb2b5 100644 --- a/ACardEmulator/app/build.gradle +++ b/ACardEmulator/app/build.gradle @@ -27,6 +27,27 @@ android { } } +android.applicationVariants.all { variant -> + def appName + //Check if an applicationName property is supplied; if not use the name of the parent project. + if (project.hasProperty("applicationName")) { + appName = applicationName + } else { + appName = parent.name + } + + variant.outputs.each { output -> + def newApkName + //If there's no ZipAlign task it means that our artifact will be unaligned and we need to mark it as such. + if (output.zipAlign) { + newApkName = "${appName}-${output.baseName}-${variant.versionName}.apk" + } else { + newApkName = "${appName}-${output.baseName}-${variant.versionName}-unaligned.apk" + } + output.outputFile = new File(output.outputFile.parent, newApkName) + } +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1'