Reputation: 9102
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.
Upvotes: 9
Views: 1477
Reputation: 321
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.
Upvotes: 1
Reputation: 2255
The Android will generate this file always when gradle sync it. But if you delete it and define ANDROID_HOME and ANDROID_NDK_HOME environment variables, every time that generates it will read ANDROID_HOME and ANDROID_NDK_HOME.
If you want to build your project in many computers with different home folders, just keep the local.properties outside the source version control.
Upvotes: 0