I have set an environment variable ANDROID_HOME
, which points to my android SDK location. However, every time I open my project in Android Studio it places local.properties
file to the root of my project and copies my SDK location from ANDROID_HOME
to this file. I want Android Studio use ANDROID_HOME
directly, without generating local.properties
.
Why? I'm on Windows 10 and I use Bash for Windows. I want to run command line using Bash while running Android Studio from Windows. For this I need two ANDROID_HOME
environment variables, one for Windows, one for Bash. This is because although they point to the same (windows) android SDK the format is different, for Windows it is C:\Users\me\Android SDK
while for Bash it's /mnt/c/Users/me/Android SDK
. When Android Studio creates local.properties
with windows path Bash becomes broken since apparently local.properties
takes advantage over ANDROID_HOME
, so I have to delete it manually.
The local. properties file goes in the project's root level, in the same folder as the gradlew , gradlew. bat , settings. gradle and other files.
Adding environment variables and java packages to use android studio and emulator. Before you start developing android apps or iOS apps with react native or with java/kotlin with android studio, you have to install a bunch of java stuff and set environment variables to path variables correctly.
Close the current project and you'll see a pop-up with a dialog which will then proceed to Configure option. Configure -> Project Defaults -> Project Structure -> SDKs on left column -> Android SDK Home Path -> give the exact path as you did on local. properties and select Valid Target.
You might find this article useful:
Posix path conversion (mingw.org)
The gradle android plugin "Application" extension (your regular gradle-android interface) has a property sdkDirectory. Perhaps this can override it? I can't check.
I think there is a configuration switch for bash on Windows to parse path separators Windows-like, can't seem to find it, it is buried deep inside MinGW or MSYS docs I think.
Last resort - git Hooks. Read the ProGit book chapter on Hooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With