I’ve some troubles trying to run my android emulator and SDK,
First, it seems that the SDK is deprecated when I try to run:
brew install --cask android-sdk
I got this error:
android-sdk has been officially discontinued upstream.
Checking here I get this post
So I tried installing the command line tools:
brew install --cask android-commandlinetools
The output for this command is this:
Downloading https://dl.google.com/android/repository/commandlinetools-mac-11076708_latest.zip
Already downloaded: /Users/testcomputer/Library/Caches/Homebrew/downloads/76a8eee9e0f62a261183b58c78c572e87fbd8acad42af527407b2974526cb4de--commandlinetools-mac-11076708_latest.zip
==> Installing Cask android-commandlinetools
==> Moving Generic Artifact 'cmdline-tools' to '/usr/local/share/android-commandlinetools/cmdline-tools/latest'
==> Linking Binary 'avdmanager' to '/usr/local/bin/avdmanager'
==> Linking Binary 'lint' to '/usr/local/bin/lint'
==> Linking Binary 'retrace' to '/usr/local/bin/retrace'
==> Linking Binary 'sdkmanager' to '/usr/local/bin/sdkmanager'
==> Linking Binary 'apkanalyzer' to '/usr/local/bin/apkanalyzer'
==> Linking Binary 'screenshot2' to '/usr/local/bin/screenshot2'
I exported the variables in my zshrc file:
export ANDROID_SDK_ROOT=/usr/local/share/android-commandlinetools
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH
I also installed the emulator:
sdkmanager "emulator"
After this I tried getting an android image:
sdkmanager "system-images;android-34;google_apis;x86_64"
This worked ok…
And create the avd:
avdmanager create avd -n myavd -k "system-images;android-34;google_apis;x86_64" --device "pixel_3"
So far so good, now I entered to my emulator path:
cd $ANDROID_SDK_ROOT
ls //=> output cmdline-tools emulator licenses platform-tools system-images
cd emulator
ls //=> LICENSE android-info.txt emulator lib64
package.xml resources
NOTICE.csv bin64 emulator-check mksdcard qemu
source.properties
NOTICE.txt crashpad_handler include netsimd qemu-img
_CodeSignature crashreport lib nimble_bridge qsn
Now I try to run my emulator:
./emulator -avd myavd
The error that I get is this:
INFO | Storing crashdata in: /tmp/android-testcomputer/emu-crash-35.1.20.db, detection is enabled for process: 68485
INFO | Android emulator version 35.1.20.0 (build_id 12234392) (CL:N/A)
INFO | Graphics backend: gfxstream
INFO | checking ANDROID_HOME for valid sdk root.
emulator: WARN: /Users/testcomputer/Library/Android/sdk is not a directory, and canot be sdk root
INFO | checking ANDROID_SDK_ROOT for valid sdk root.
WARNING | platforms subdirectory is missing under /usr/local/share/android-commandlinetools, please install it
emulator: WARN: Cannot find valid sdk root from environment variable ANDROID_HOME nor ANDROID_SDK_ROOT,Try to infer from emulator's path
INFO | guessed sdk root is /usr/local/share/android-commandlinetools
WARNING | platforms subdirectory is missing under /usr/local/share/android-commandlinetools, please install it
INFO | guessed sdk root /usr/local/share/android-commandlinetools does not seem to be valid
INFO | guessed sdk root is /usr/local/share
WARNING | platforms subdirectory is missing under /usr/local/share, please install it
INFO | guessed sdk root /usr/local/share does not seem to be valid
INFO | guessed sdk root is /usr/local
WARNING | platforms subdirectory is missing under /usr/local, please install it
INFO | guessed sdk root /usr/local does not seem to be valid
WARNING | invalid sdk root /usr/local
emulator: WARN: Cannot find valid sdk root path.
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/usr/local/share/android-commandlinetools]!
Do I need to install something else?… Not sure why this tries to access to SDK folder when using android-commandlinetools I don’t have a SDK folder
Hope you can help me guys, I’m a newbie with android development. Thank you!