From 50ab6decfeffb04b3f6409e573d76bed6150d52b Mon Sep 17 00:00:00 2001 From: fhuya Date: Thu, 12 Dec 2019 19:52:57 -0500 Subject: Replace the android.defaultConfig.applicationId in build.gradle with the package/unique_name. --- platform/android/java/app/build.gradle | 2 +- platform/android/java/app/config.gradle | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'platform/android/java') diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle index 9f64c3dc8a..258ca9197a 100644 --- a/platform/android/java/app/build.gradle +++ b/platform/android/java/app/build.gradle @@ -51,7 +51,7 @@ android { defaultConfig { // Feel free to modify the application id to your own. - applicationId "com.godot.game" + applicationId getExportPackageName() minSdkVersion versions.minSdk targetSdkVersion versions.targetSdk //CHUNK_ANDROID_DEFAULTCONFIG_BEGIN diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index 20c3123221..862a954fac 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -10,3 +10,13 @@ ext.versions = [ ext.libraries = [ androidGradlePlugin : "com.android.tools.build:gradle:$versions.androidGradlePlugin" ] + +ext.getExportPackageName = { -> + // Retrieve the app id from the project property set by the Godot build command. + String appId = project.hasProperty("export_package_name") ? project.property("export_package_name") : "" + // Check if the app id is valid, otherwise use the default. + if (appId == null || appId.isEmpty()) { + appId = "com.godot.game" + } + return appId +} -- cgit v1.2.3