Installing SDK and AVD and start Emulator from Command Line

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Installing SDK and AVD and start Emulator from Command Line

Post by sphere » 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
Last edited by sphere on Fri Sep 08, 2017 2:16 pm, edited 1 time in total.

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Installing SDK and AVD and start Emulator from Command L

Post by MaxV » Mon Sep 04, 2017 12:56 pm

You can write your recipes on http://livecode.wikia.com/wiki/Livecode_Wiki
It's free and well formatted. :D
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Installing SDK and AVD and start Emulator from Command L

Post by sphere » Mon Sep 04, 2017 7:13 pm

Thanks MaxV, maybe i will put a copy there

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Installing SDK and AVD and start Emulator from Command Line

Post by sphere » Thu Jan 18, 2018 1:40 pm

Apperantly the AVD creation bug is solved.
I just tried this on another Win10 PC and it created AVD without problem.

since we created the AVD like this:
avdmanager create avd -n androidsix -k "system-images;android-23;default;armeabi-v7a"

you can start it via this:
emulator -avd androidsix

First the loaded screen looked to big for the rectangle screen, but after loading it seems ok.

see more info here:
https://developer.android.com/studio/co ... nager.html

so with this you don't need to start Android Studio at all on windows to get an emulator running.

Post Reply

Return to “Android Deployment”