From 521a81ce8c7d5378a05652e80c19c9fcaf4782db Mon Sep 17 00:00:00 2001 From: Joseph Cloutier Date: Sun, 16 Oct 2016 15:41:47 -0400 Subject: [PATCH] Make Gradle use the right APK filename. Rather than making Lime rename it after the fact. --- lime/tools/platforms/AndroidPlatform.hx | 11 ++++------- templates/android/template/app/build.gradle | 10 ++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lime/tools/platforms/AndroidPlatform.hx b/lime/tools/platforms/AndroidPlatform.hx index 2221d1c74..0562eb8be 100644 --- a/lime/tools/platforms/AndroidPlatform.hx +++ b/lime/tools/platforms/AndroidPlatform.hx @@ -179,20 +179,17 @@ class AndroidPlatform extends PlatformTarget { public override function install ():Void { - var build = "debug"; + var build = "-debug"; if (project.certificate != null) { - build = "release"; + build = "-release"; } - var apkPath = FileSystem.fullPath (targetDirectory) + "/bin/app/build/outputs/apk/"; - var apkSuffix = "-" + build + ".apk"; + var apkPath = FileSystem.fullPath (targetDirectory) + "/bin/app/build/outputs/apk/" + project.app.file + build + ".apk"; - File.copy (apkPath + "app" + apkSuffix, apkPath + project.app.file + apkSuffix); - - deviceID = AndroidHelper.install (project, apkPath + project.app.file + apkSuffix, deviceID); + deviceID = AndroidHelper.install (project, apkPath, deviceID); } diff --git a/templates/android/template/app/build.gradle b/templates/android/template/app/build.gradle index 4d8e3925d..a1e725d9c 100644 --- a/templates/android/template/app/build.gradle +++ b/templates/android/template/app/build.gradle @@ -48,6 +48,16 @@ android { signingConfig signingConfigs.release } } + + android.applicationVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + + if (outputFile != null && outputFile.name.endsWith('.apk')) { + output.outputFile = new File(outputFile.parent, "::APP_FILE::-" + variant.buildType.name + ".apk") + } + } + } } dependencies {