Android Question How can the AVD Manager be executed from the command line?

Mikonios

Active Member
Licensed User
Longtime User
From Tools / Run AVD Manager does not open the administrator of AVD, but the B4A AVDManager.
And from the B4A AVDManager I do not know how to create new virtual devices outside Platform 24.
Attached image.

I have AVD Manager installed but I do not know how to open it from the command line.
Is it possible to open it?
How can the AVD Manager be executed from the command line?



I do not mean the emulator: D: \ 0000AndroidEstudio \ Componentes \ emulator \ emulator.exe -avd Note3_API_27
I mean the avdmanager: D: \ 0000AndroidEstudio \ Components \ tools \ bin \ avdmanager.bat
Attached other image.

AvdManager.jpg



AvdManager1.jpg

AvdManager2.jpg
 

Mikonios

Active Member
Licensed User
Longtime User
I just wanted to avoid hard disk space problems and keep the installations separate.
Without duplicating the different api's for android and for B4A.
I leave the question on the air in case anyone knows the way.
Thanks for the reply.


AvdManager4.jpg
 
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
When you click "Run AVD manager" in B4A IDE menu, actually you can run everything what you want.
Simply replace B4ASDKManager.jar by your own variant. You can find the source code in https://www.b4x.com/android/forum/threads/b4a-sdk-manager-source-code.91995/

But I don't understand your target. Do you want to have both Android Studio and B4A SDK folder ? Why ? B4A does not need Android Studio at all and is able to create AVD for any platform. More ... Using skins it's possible to extend a list of availables phones.
 
Upvote 0

Mikonios

Active Member
Licensed User
Longtime User
Hi Matusovskiy,
The reason for both installations, that I have other apps developed with Android Studio that I must expand and improve. In addition to the one I am testing with B4A. I need both environments on the same machine, but I made the mistake of installing and downloading B4ASdkManager on C: and this unit has very little free space and I can not duplicate the Studio APIs on C: for the B4A APIs. But in the end I will have to install B4ASdkManager on another unit and compile again. It is a question of space and time. I will review the link you indicate.
Thank you very much for your interest and response.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
There is one useful command MKLINK. You can redirect Android SDK folder to another disk. So, programs will continue to use a path C:\Users\<user>\AppData\Local\Android unlike phisically the folder will be on disk D. By this way you can redirect AVD folder also.
 
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
Hi Matusovskiy,
The reason for both installations, that I have other apps developed with Android Studio that I must expand and improve. In addition to the one I am testing with B4A. I need both environments on the same machine, but I made the mistake of installing and downloading B4ASdkManager on C: and this unit has very little free space and I can not duplicate the Studio APIs on C: for the B4A APIs. But in the end I will have to install B4ASdkManager on another unit and compile again. It is a question of space and time. I will review the link you indicate.
Thank you very much for your interest and response.
I also did a recent post that shows how to create a junction point. So all my stuff is actually in a "secret" directory on H, but I have a junction point on C so everything thinks its there.
eg:
B4X:
mklink /D /J c:\Java "H:\JunctionSources\C_Java"
I'm running Win7 64b. On the other thread, some said later windows required a further download as its no longer part of the standard windows install.
I have over 10 junction points (in addition to the standard windows ones) of some biiiiig directories.
 
Upvote 0

Mikonios

Active Member
Licensed User
Longtime User
Hello JohnK, thank you very much for your answer.
I am trying to launch avdmanager.bat from the desktop, but it gives me some error that I can not solve, although as you say right I think it is posible.


Assuming the following:
B4X:
AvdManager folder (Android Studio running) ::
D:\0000AndroidEstudio\Componentes\tools\bin\avdmanagerRun.bat
B4X:
Java folder (B4a running)   ::
C:\Program Files\Java\jdk1.8.0_144\bin\javac.exe
B4X:
I create Symbolic Link (As you indicate me)  ::
mklink /D /J D:\java "C:\Program Files\Java\jdk1.8.0_144\bin"
B4X:
Modify avdmanagerRun.bat adding to the start  ::
set JAVA_HOME=D:\java

When I run as administrator "avdmanagerRun.bat" the system responds:
Error: main class java.se.ee not found or loaded

My question is:
Have you managed to launch avdmanager.bat from the command line and it has worked for you?
Could you indicate the modifications you have made step by step in order to replicate them and make it work for me?


Attached response of the system command
B4X:
D:\0000AndroidEstudio\Componentes\tools\bin>avdmanagerRun.bat
D:\0000AndroidEstudio\Componentes\tools\bin>set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144\bin
D:\0000AndroidEstudio\Componentes\tools\bin>if "Windows_NT" == "Windows_NT" setlocal
D:\0000AndroidEstudio\Componentes\tools\bin>set DIRNAME=D:\0000AndroidEstudio\Componentes\tools\bin\
D:\0000AndroidEstudio\Componentes\tools\bin>if "D:\0000AndroidEstudio\Componentes\tools\bin\" == "" set DIRNAME=.
D:\0000AndroidEstudio\Componentes\tools\bin>set APP_BASE_NAME=avdmanagerRun
D:\0000AndroidEstudio\Componentes\tools\bin>set APP_HOME=D:\0000AndroidEstudio\Componentes\tools\bin\..
D:\0000AndroidEstudio\Componentes\tools\bin>set JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
D:\0000AndroidEstudio\Componentes\tools\bin>set DEFAULT_JVM_OPTS="-Dcom.android.sdkmanager.toolsdir=D:\0000AndroidEstudio\Componentes\tools\bin\\.."
D:\0000AndroidEstudio\Componentes\tools\bin>if defined JAVA_HOME goto findJavaFromJavaHome
D:\0000AndroidEstudio\Componentes\tools\bin>set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144\bin
D:\0000AndroidEstudio\Componentes\tools\bin>set JAVA_EXE=C:\Program Files\Java\jdk1.8.0_144\bin/java.exe
D:\0000AndroidEstudio\Componentes\tools\bin>if exist "C:\Program Files\Java\jdk1.8.0_144\bin/java.exe" goto init
D:\0000AndroidEstudio\Componentes\tools\bin>if not "Windows_NT" == "Windows_NT"goto win9xME_args
D:\0000AndroidEstudio\Componentes\tools\bin>set CMD_LINE_ARGS=
D:\0000AndroidEstudio\Componentes\tools\bin>set _SKIP=2
D:\0000AndroidEstudio\Componentes\tools\bin>if "x" == "x" goto execute

D:\0000AndroidEstudio\Componentes\tools\bin>set CLASSPATH=D:\0000AndroidEstudio\
Componentes\tools\bin\..\lib\dvlib-26.0.0-dev.jar;D:\0000AndroidEstudio\Componen
tes\tools\bin\..\lib\jimfs-1.1.jar;D:\0000AndroidEstudio\Componentes\tools\bin\.
.\lib\jsr305-1.3.9.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\reposi
tory-26.0.0-dev.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\j2objc-an
notations-1.1.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\layoutlib-a
pi-26.0.0-dev.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\gson-2.3.ja
r;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\httpcore-4.2.5.jar;D:\0000A
ndroidEstudio\Componentes\tools\bin\..\lib\commons-logging-1.1.1.jar;D:\0000Andr
oidEstudio\Componentes\tools\bin\..\lib\commons-compress-1.12.jar;D:\0000Android
Estudio\Componentes\tools\bin\..\lib\annotations-26.0.0-dev.jar;D:\0000AndroidEs
tudio\Componentes\tools\bin\..\lib\error_prone_annotations-2.0.18.jar;D:\0000And
roidEstudio\Componentes\tools\bin\..\lib\animal-sniffer-annotations-1.14.jar;D:\
0000AndroidEstudio\Componentes\tools\bin\..\lib\httpclient-4.2.6.jar;D:\0000Andr
oidEstudio\Componentes\tools\bin\..\lib\commons-codec-1.6.jar;D:\0000AndroidEstu
dio\Componentes\tools\bin\..\lib\common-26.0.0-dev.jar;D:\0000AndroidEstudio\Com
ponentes\tools\bin\..\lib\kxml2-2.3.0.jar;D:\0000AndroidEstudio\Componentes\tool
s\bin\..\lib\httpmime-4.1.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib
\annotations-12.0.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\sdklib-
26.0.0-dev.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\guava-22.0.jar


D:\0000AndroidEstudio\Componentes\tools\bin>"C:\Program Files\Java\jdk1.8.0_144\
bin/java.exe" "-Dcom.android.sdkmanager.toolsdir=D:\0000AndroidEstudio\Component
es\tools\bin\\.." -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee   -c
lasspath "D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\dvlib-26.0.0-dev.ja
r;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\jimfs-1.1.jar;D:\0000Androi
dEstudio\Componentes\tools\bin\..\lib\jsr305-1.3.9.jar;D:\0000AndroidEstudio\Com
ponentes\tools\bin\..\lib\repository-26.0.0-dev.jar;D:\0000AndroidEstudio\Compon
entes\tools\bin\..\lib\j2objc-annotations-1.1.jar;D:\0000AndroidEstudio\Componen
tes\tools\bin\..\lib\layoutlib-api-26.0.0-dev.jar;D:\0000AndroidEstudio\Componen
tes\tools\bin\..\lib\gson-2.3.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..
\lib\httpcore-4.2.5.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\commo
ns-logging-1.1.1.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\commons-
compress-1.12.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\annotations
-26.0.0-dev.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\error_prone_a
nnotations-2.0.18.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\animal-
sniffer-annotations-1.14.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\
httpclient-4.2.6.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\commons-
codec-1.6.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\common-26.0.0-d
ev.jar;D:\0000AndroidEstudio\Componentes\tools\bin\..\lib\kxml2-2.3.0.jar;D:\000
0AndroidEstudio\Componentes\tools\bin\..\lib\httpmime-4.1.jar;D:\0000AndroidEstu
dio\Componentes\tools\bin\..\lib\annotations-12.0.jar;D:\0000AndroidEstudio\Comp
onentes\tools\bin\..\lib\sdklib-26.0.0-dev.jar;D:\0000AndroidEstudio\Componentes
\tools\bin\..\lib\guava-22.0.jar" com.android.sdklib.tool.AvdManagerCli

Error: no se ha encontrado o cargado la clase principal java.se.ee

D:\0000AndroidEstudio\Componentes\tools\bin>if "1" == "0" goto mainEnd
D:\0000AndroidEstudio\Componentes\tools\bin>rem Set variable AVDMANAGER_EXIT_CONSOLE if you need the _script_ return code instead of
D:\0000AndroidEstudio\Componentes\tools\bin>rem the _cmd.exe /c_ return code!
D:\0000AndroidEstudio\Componentes\tools\bin>if not "" == "" exit 1
D:\0000AndroidEstudio\Componentes\tools\bin>exit /b 1
D:\0000AndroidEstudio\Componentes\tools\bin>
 
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I do not change avdmanager.bat. I set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181 in Control Panel, System, additional parameters, environment for all users (I use non English Windows, so real english names sounds a little another).

To run avdmanager it's possible to use cmd.exe, PowerShell etc. I start as administrator. The output (if without parameters):
B4X:
Usage:
      avdmanager [global options] [action] [action options]
      Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

Valid actions are composed of a verb and an optional direct object:
-   list              : Lists existing targets or virtual devices.
-   list avd          : Lists existing Android Virtual Devices.
-   list target       : Lists existing targets.
-   list device       : Lists existing devices.
- create avd          : Creates a new Android Virtual Device.
-   move avd          : Moves or renames an Android Virtual Device.
- delete avd          : Deletes an Android Virtual Device.
 
Last edited:
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
B4X:
Usage:
      avdmanager [global options] [action] [action options]
      Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

Valid actions are composed of a verb and an optional direct object:
-   list              : Lists existing targets or virtual devices.
-   list avd          : Lists existing Android Virtual Devices.
-   list target       : Lists existing targets.
-   list device       : Lists existing devices.
- create avd          : Creates a new Android Virtual Device.
-   move avd          : Moves or renames an Android Virtual Device.
- delete avd          : Deletes an Android Virtual Device.
I think what is being asked above is starting the AVD Manager GUI, whereas the response you are seeing at the command prompt, is the shell interface.

As to the question if I got it started, the answer is no. I did not spend too much time on it.

The one thing I was planning on looking into next as a lead was the fact that when in Android Studio, if you search the help file for "AVD" a link is displayed that does not open a help page, but actually starts the AVD Manager UI. I was thinking if it bothered me too much (starting android studio first to get to the UI), one day, eventually, I would look into the binary/help file and see if any clues could be garnered there.
 
Upvote 0
Top