Installing SDK and AVD and start Emulator from Command Line
Posted: Sat Sep 02, 2017 3:08 pm
Installing SDK and AVD and start Emulator from Command Line (Without Android Studio)
a HowTo install Android SDK and AVD and start Emulator from Command Line
This is based on windows, but should be similair for Mac and Linux, on Stackoverflow you can find more help on the correct syntax.
First create a folder c:\users\username\appdata\local\android-sdk\
2nd add the folder/directory were the sdk will be installed to your Environment (needed for Windows)
Click on start and search on Environment then add the line below to the path.
Normally in Windows this is c:\users\username\appdata\local\android-sdk\
Lets keep it here as former SDKgui was also installed here and Google Studio does too.
If you do not add it to your path in Environment settings then you need to go to the folder stated above in CMD (DOS terminal).
Go to https://developer.android.com/studio/index.html and scroll all the way down and download the command line package for your computer.
Unzip it to the folder you made.
With the command: sdkmanager --list --verbose ,you'll get a whole list of available packages which is not truncated so you can read clear what all is.
------------------------------------------------------------------------------------------------------------------------------------------
All below commands you can also set in a text file like packages.txt, put the text file in the same install folder.
then in Command Terminal type: sdkmanager --package_file=packages.txt
Now i did not test this, because i don't know how it reacts, for some commands you need to confirm with yes.
------------------------------------------------------------------------------------------------------------------------------------------
So here we do it manual, line by line, it takes a while, so wait until 'Done' is presented after each command:
sdkmanager system-images;android-23;default;armeabi-v7a (i changed this from google_apis;x86 as it seems lc does not support x86, but i've read that x86 should be used i you are on a x86 platform)
sdkmanager sources;android-15
sdkmanager sources;android-23
sdkmanager platform-tools (this one is important else LC won't recoqnize the folder as sdk folder)
sdkmanager platforms;android-15 (this is the minimum needed Android 4.0.3 for LC)
sdkmanager platforms;android-23 (this is android 6.0)
sdkmanager lldb;2.3
sdkmanager ndk-bundle (not really needed)
sdkmanager patcher;v4
sdkmanager emulator
sdkmanager docs (if you need docs)
sdkmanager extras;google;google_play_services
sdkmanager extras;google;market_licensing (not really needed)
sdkmanager extras;google;usb_driver
sdkmanager extras;intel;Hardware_Accelerated_Execution_Manager
sdkmanager extras;play_billing (not really needed)
sdkmanager build-tools;26.0.1
sdkmanager add-ons;addon-google_apis-google-15
sdkmanager add-ons;addon-google_apis-google-23
Now you can set the SDK root in LC-->Preferencces-->Mobile-Support
if you want to update all installed packes then type: sdkmanager --update
***I will update this post for the AVD and Emulator ***
This line should create an AVD:
avdmanager create avd -n androidsix -k "system-images;android-23;default;armeabi-v7a"
but i get this error:
Exception in thread "main" java.lang.NullPointerException
at com.android.sdklib.tool.AvdManagerCli.createAvd(AvdManagerCli.java:686)
at com.android.sdklib.tool.AvdManagerCli.doAction(AvdManagerCli.java:369)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:205)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:195)
So i filed a bug at Google https://issuetracker.google.com/issues/65314000
a HowTo install Android SDK and AVD and start Emulator from Command Line
This is based on windows, but should be similair for Mac and Linux, on Stackoverflow you can find more help on the correct syntax.
First create a folder c:\users\username\appdata\local\android-sdk\
2nd add the folder/directory were the sdk will be installed to your Environment (needed for Windows)
Click on start and search on Environment then add the line below to the path.
Normally in Windows this is c:\users\username\appdata\local\android-sdk\
Lets keep it here as former SDKgui was also installed here and Google Studio does too.
If you do not add it to your path in Environment settings then you need to go to the folder stated above in CMD (DOS terminal).
Go to https://developer.android.com/studio/index.html and scroll all the way down and download the command line package for your computer.
Unzip it to the folder you made.
With the command: sdkmanager --list --verbose ,you'll get a whole list of available packages which is not truncated so you can read clear what all is.
------------------------------------------------------------------------------------------------------------------------------------------
All below commands you can also set in a text file like packages.txt, put the text file in the same install folder.
then in Command Terminal type: sdkmanager --package_file=packages.txt
Now i did not test this, because i don't know how it reacts, for some commands you need to confirm with yes.
------------------------------------------------------------------------------------------------------------------------------------------
So here we do it manual, line by line, it takes a while, so wait until 'Done' is presented after each command:
sdkmanager system-images;android-23;default;armeabi-v7a (i changed this from google_apis;x86 as it seems lc does not support x86, but i've read that x86 should be used i you are on a x86 platform)
sdkmanager sources;android-15
sdkmanager sources;android-23
sdkmanager platform-tools (this one is important else LC won't recoqnize the folder as sdk folder)
sdkmanager platforms;android-15 (this is the minimum needed Android 4.0.3 for LC)
sdkmanager platforms;android-23 (this is android 6.0)
sdkmanager lldb;2.3
sdkmanager ndk-bundle (not really needed)
sdkmanager patcher;v4
sdkmanager emulator
sdkmanager docs (if you need docs)
sdkmanager extras;google;google_play_services
sdkmanager extras;google;market_licensing (not really needed)
sdkmanager extras;google;usb_driver
sdkmanager extras;intel;Hardware_Accelerated_Execution_Manager
sdkmanager extras;play_billing (not really needed)
sdkmanager build-tools;26.0.1
sdkmanager add-ons;addon-google_apis-google-15
sdkmanager add-ons;addon-google_apis-google-23
Now you can set the SDK root in LC-->Preferencces-->Mobile-Support
if you want to update all installed packes then type: sdkmanager --update
***I will update this post for the AVD and Emulator ***
This line should create an AVD:
avdmanager create avd -n androidsix -k "system-images;android-23;default;armeabi-v7a"
but i get this error:
Exception in thread "main" java.lang.NullPointerException
at com.android.sdklib.tool.AvdManagerCli.createAvd(AvdManagerCli.java:686)
at com.android.sdklib.tool.AvdManagerCli.doAction(AvdManagerCli.java:369)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:205)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:195)
So i filed a bug at Google https://issuetracker.google.com/issues/65314000