summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-30 18:24:38 +0100
committerGitHub <noreply@github.com>2019-12-30 18:24:38 +0100
commit833ef704661712fd7a5b3befe9bf280100ec9a32 (patch)
tree121b9f49981cb90e5ea68198197492799ec06e0f
parent33b560a5cf1334d8d345eea36229230ef3d08027 (diff)
parent50ab6decfeffb04b3f6409e573d76bed6150d52b (diff)
Merge pull request #34317 from m4gr3d/make_app_id_match_godot_package_name
Replace the android.defaultConfig.applicationId in build.gradle with the package/unique_name
-rw-r--r--platform/android/export/export.cpp7
-rw-r--r--platform/android/java/app/build.gradle2
-rw-r--r--platform/android/java/app/config.gradle10
3 files changed, 16 insertions, 3 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 0645efccd7..2a3e4e754e 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1984,10 +1984,13 @@ public:
build_command = build_path.plus_file(build_command);
+ String package_name = get_package_name(p_preset->get("package/unique_name"));
+
List<String> cmdline;
cmdline.push_back("build");
- cmdline.push_back("-p");
- cmdline.push_back(build_path);
+ cmdline.push_back("-Pexport_package_name=" + package_name); // argument to specify the package name.
+ cmdline.push_back("-p"); // argument to specify the start directory.
+ cmdline.push_back(build_path); // start directory.
/*{ used for debug
int ec;
String pipe;
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
+}