misc/androidstudio: handle missing local.properties.
Fixes golang/go#12543
Change-Id: Ifb91e073ff2ebcba111e279949d5120a77b0dc2d
Reviewed-on: https://go-review.googlesource.com/14475
Reviewed-by: David Crawshaw <crawshaw@golang.org>
diff --git a/misc/androidstudio/build.gradle b/misc/androidstudio/build.gradle
index 68760dc..1980001 100644
--- a/misc/androidstudio/build.gradle
+++ b/misc/androidstudio/build.gradle
@@ -31,7 +31,7 @@
website = 'https://golang.org/x/mobile'
vcsUrl = 'https://golang.org/x/mobile'
description = 'Plugin for gomobile projects (beta)'
- version = '0.2.2'
+ version = '0.2.3'
plugins {
gobindPlugin {
diff --git a/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy b/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy
index 0721bf6..91b6b15 100644
--- a/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy
+++ b/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy
@@ -71,9 +71,14 @@
paths = [findDir(gomobile), findDir(gobin), paths].flatten()
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- def androidHome = properties.getProperty('sdk.dir')
+ def androidHome = ""
+ try {
+ Properties properties = new Properties()
+ properties.load(project.rootProject.file('local.properties').newDataInputStream())
+ androidHome = properties.getProperty('sdk.dir')
+ } catch (all) {
+ logger.info("failed to load local.properties.")
+ }
if (!androidHome?.trim()) {
// fallback to ANDROID_HOME
androidHome = System.getenv("ANDROID_HOME")