-
Star
(439)
You must be signed in to star a gist -
Fork
(117)
You must be signed in to fork a gist
-
-
Save patrickhammond/4ddbe49a67e5eb1b9c03 to your computer and use it in GitHub Desktop.
| - Install Homebrew: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
| - brew install maven | |
| - brew install gradle | |
| - brew install ant | |
| - brew install android-sdk | |
| - brew install android-platform-tools | |
| - brew install android-ndk | |
| - android update sdk --no-ui | |
| - Setup HAXM | |
| - export ANDROID_HOME=/usr/local/opt/android-sdk |
brew cask install android-sdk brings in the version without the android command. You now have to use sdkmanager
my android_sdk path is set to /usr/local/Caskroom/android-sdk/25.2.3 after i did brew cask install android_sdk
But when i try to create android app using native CLI, it gives me an error
The ANDROID_HOME environment variable points to incorrect directory. You will not be able to perform any build-related operations for Android
For anyone with NPE error and a stacktrace related to NDK i had to do this to fix.
Remove export ANDROID_NDK_HOME=/usr/local/opt/android-ndk
Use sdkmanager --update instead android sdk update
@hprobotic I'm trying to run the emulator but I get android sdk not found, has anyone see same problem. I'm using brew cask install android-sdk and my configuration is this
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_NDK_HOME=/usr/local/opt/android-ndk
export PATH="$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools:$PATH"
sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
sdkmanager --update
sdkmanager --list
#avdmanager create avd -n Nexus6P -k "system-images;android-23;google_apis;x86_64" -b google_apis/x86_64 -c 100M -d 7 -f
avdmanager create avd -n test -k "system-images;android-25;google_apis;armeabi-v7a" -b armeabi-v7a -c 100M -d 7 -f
avdmanager list avd
cd $(dirname $(which emulator)) && ./emulator @test -no-audio -no-window -verbose
I get error
emulator: qemu backend: argv[00] = "../emulator/qemu/darwin-x86_64/qemu-system-armel"
emulator: qemu backend: argv[01] = "@test"
emulator: qemu backend: argv[02] = "-no-audio"
emulator: qemu backend: argv[03] = "-no-window"
emulator: qemu backend: argv[04] = "-verbose"
emulator: Concatenated backend parameters:
../emulator/qemu/darwin-x86_64/qemu-system-armel @test -no-audio -no-window -verbose
emulator: ERROR: can't find SDK installation directory
emulator: could not find virtual device named 'test'
@jpca999 use
brew install caskroom/cask/android-ndk
or just:
brew cask install android-sdk
brew cask install android-ndk
Having the ANT_HOME environment variable set breaks ant.
With it set:
% ant --execdebug
exec "$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="$ANT_HOME" -Dant.library.dir="$ANT_LIB" org.apache.tools.ant.launch.Launcher -cp "$CLASSPATH" "-lib" "/usr/local/share/ant" Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
Without it set:
% ant --execdebug
exec "$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="$ANT_HOME" -Dant.library.dir="$ANT_LIB" org.apache.tools.ant.launch.Launcher -cp "$CLASSPATH"
Buildfile: build.xml does not exist!
Build failed
Ref. this issue.
Update your environment variables
From http://hathaway.cc/post/69201163472/how-to-edit-your-path-environment-variables-on-mac:
https://apple.stackexchange.com/questions/106778/how-do-i-set-environment-variables-on-os-x
android-28 / android-30
sdk can be installed on /Library/Android/sdk or /usr/local/ to be sure check it by
which sdkmanager
Export ANDROID_HOME
export ANDROID_HOME=$HOME/Library/Android/sdk
or
export ANDROID_HOME="/usr/local/share/android-sdk"
Both are valid locations for the android sdk from what I am aware of :)
android-28 / android-30
Copy paste, It's a good idea double check your paths anyways.
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
see
Update:
Use Homebrew to install Android dev tools:
brew cask install android-sdk
brew cask install android-ndk
Update your environment variables:
export ANDROID_NDK_HOME=/usr/local/share/android-ndk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
Install all of the Android SDK components:
sdkmanager --update
Thanks @mrded !
Almost one-line offer.
Can you update the instructions save reading all the threads, its the following for me:
brew cask install android-sdk
brew cask install android-ndk
I had so much trouble getting the android sdk and java sdk working with my Pixel, running through multiple iterations of Android Studio setup and different versions of Java. I am on OSX
I finally started over and settled on the following:
java version "1.8.0_171" (JDK 8)
This brew cask was the only thing I could get my Pixel working with:
brew cask install android-studio
react-native-cli: 2.0.1
Thanks to the makers of that cask.
Do you want to avoid struggle with this setup? Read this tutorial
@molcik that website is just absolute spam. It only provides an alternative "solution" of installing Android Studio. And then links to this very gist.
Should probably be reported as spam...
Of course,
brew cask install javawill install and help you maintain the JDK.
or asdf plugin-add java && asdf install java oracle-8.191 && asdf global java oracle-8.191
Thank you so much , Finally working with showing this error Cannot find AVD system path. Please define ANDROID_SDK_ROOT
android-ndk is no longer available.
2019 Update:
Some packages have been removed or changed (such as java, android-ndk, etc). This is what worked for me:
brew cask install adoptopenjdk8
brew cask install android-sdk
echo "export ANDROID_HOME=/usr/local/share/android-sdk" >> ~/.bash_profile
source ~/.bash_profile
touch ~/.android/repositories.cfg
sdkmanager --update
sdkmanager "platform-tools" "platforms;android-28"
The sdkmanager had a problem when ~/.android/repositories.cfg didn't exist, but by simply creating the file, it solved the problem.
Install with:
brew cask install android-studio
brew cask install android-studio
brew install android-studio --cask since new brew
For People who make both Android, iOS Apps i made a crazy doc here
Enjoy !
Note, adoptopendk8 has been officially discontinued, it may stop working in recent versions of MacOS.
Temurin is the official successor:
brew install --cask temurin8
I advice you guy to use Jabba instead of anything else ! https://github.com/shyiko/jabba
It's better to use sdkman to instal any jdk version (temurin or any other), ant, gradle and maven
brew install android-sdk --cask
Error: Cask 'android-sdk' has been disabled because it is discontinued upstream! It was disabled on 2024-12-16.

Hi,
android-sdkis no more available inbrew installbutbrew cask install android-sdk