snapcrafters / android-studio

A community-maintained package to easily install Android Studio on Linux
https://developer.android.com/studio/index.html
46 stars 15 forks source link

set ANDROID_HOME for gradle to find SDK #21

Closed abitrolly closed 2 years ago

abitrolly commented 6 years ago

I am not sure if non-snap version does this, but it makes sense to setup ANDROID_HOME when SDK is installed, so that other programs like gradle can find it. Example

./gradlew

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or
with an ANDROID_HOME environment variable.
om26er commented 6 years ago

The Android Studio snap is isolated from your environment, so any environment variable exported by it will only be available to the snap itself and not your system externally, so you will have to export that variable manually unfortunately.

abitrolly commented 6 years ago

I am running it as ANDROID_HOME=~/Android/Sdk now. ~/Android/Sdk exists outside of snap, but I don't remember - isn't it android-studio in classic confinement who downloaded and placed SDK there?

om26er commented 2 years ago

While android studio downloads the sdk, to make the sdk "readable" by other programs you have to export that variable yourself.