JakeWharton / sdk-manager-plugin

DEPRECATED Gradle plugin which downloads and manages your Android SDK.
Apache License 2.0
1.41k stars 142 forks source link

Missing local.properties file causes download of SDK in Android Studio, even with $ANDROID_HOME set. #30

Closed aried3r closed 10 years ago

aried3r commented 10 years ago

OS X 10.9.3 Android Studio 0.5.8 Android Gradle Plugin 0.10.+ SDK-Manager-Plugin 0.10.+ Gradle Wrapper with Gradle 1.11

I deleted local.properties, started Android Studio as usual and noticed a very long delay when building, the Gradle Console showed the following:

14:59:08.318 [DEBUG] [com.jakewharton.sdkmanager.internal.SdkResolver] Missing local.properties.
14:59:08.319 [DEBUG] [com.jakewharton.sdkmanager.internal.SdkResolver] Missing ANDROID_HOME.
14:59:08.320 [LIFECYCLE] [com.jakewharton.sdkmanager.internal.SdkResolver] Android SDK not found. Downloading...

In iTerm2

$> echo $ANDROID_HOME
/Development/android-sdk

This does not happen using the gradle wrapper from the terminal.

$> gw clean build --debug
15:04:52.226 [DEBUG] [com.jakewharton.sdkmanager.internal.SdkResolver] Missing local.properties.
15:04:52.228 [DEBUG] [com.jakewharton.sdkmanager.internal.SdkResolver] Found ANDROID_HOME at '/Development/android-sdk'. Writing to local.properties.
JakeWharton commented 10 years ago

There's nothing this plugin can do about that. However, you can change your setup a bit to make it work properly.

Environment variables declared in shell-specific init files aren't not honored for GUI applications on OS X (e.g., .bash_profile). You have to specify environment variables using launchctl:

launchctl setenv ANDROID_HOME /Development/android-sdk

In order for this to be honored you will need to reboot (or maybe just log out and log back in).

aried3r commented 10 years ago

Thank you for the explanation and quick response.