From 3b8d0bee4a94a9cc715a71458c9d1ec8aafcbd0e Mon Sep 17 00:00:00 2001 From: Emre Kultursay Date: Mon, 20 May 2024 14:20:17 -0700 Subject: [PATCH] Fix detecting when Gradle is invoked from Studio The existing 'idea.platform.prefix' system-property approach only worked because of a Android Studio bug that leaks the system properties from Android Studio into Gradle build: - https://issuetracker.google.com/201075423 This bug was fixed in Android Studio 2023.3.1 (Jellyfish). The correct way of identifying builds from Android Studio is to use the following project property (not system property): - android.injected.invoked.from.ide --- platform/android/java/app/config.gradle | 3 +-- platform/android/java/build.gradle | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index d27e75b07aa..c404af34d81 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -330,8 +330,7 @@ ext.getReleaseKeyAlias = { -> } ext.isAndroidStudio = { -> - def sysProps = System.getProperties() - return sysProps != null && sysProps['idea.platform.prefix'] != null + return project.hasProperty('android.injected.invoked.from.ide') } ext.shouldZipAlign = { -> diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle index c609b33ef47..b91b023ce62 100644 --- a/platform/android/java/build.gradle +++ b/platform/android/java/build.gradle @@ -232,11 +232,6 @@ def generateBuildTasks(String flavor = "template") { return tasks } -def isAndroidStudio() { - def sysProps = System.getProperties() - return sysProps != null && sysProps['idea.platform.prefix'] != null -} - task copyEditorReleaseApkToBin(type: Copy) { dependsOn ':editor:assembleRelease' from('editor/build/outputs/apk/release')