summaryrefslogtreecommitdiff
path: root/platform/android/java
diff options
context:
space:
mode:
authorfhuya <fhuya@google.com>2019-12-12 19:52:57 -0500
committerfhuya <fhuya@google.com>2019-12-30 10:33:48 -0500
commit50ab6decfeffb04b3f6409e573d76bed6150d52b (patch)
treeb2a8ca12442217b1c3dd80cfa40be12d4ce51599 /platform/android/java
parentedf2ed5e5056b3f37014cafb2571dd31d65a4a96 (diff)
Replace the android.defaultConfig.applicationId in build.gradle with the package/unique_name.
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/app/build.gradle2
-rw-r--r--platform/android/java/app/config.gradle10
2 files changed, 11 insertions, 1 deletions
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
+}