Android Tutorial GUI SDK Manager for newer versions of Android tools

Erel

Administrator
Staff member
Licensed User
Edit: If you are using B4A v7.8+ then a newer version of B4A Sdk Manager is preinstalled. Follow these instructions instead: https://www.b4x.com/b4a.html#installation

The GUI interface of Android SDK Manager has been removed in the latest version of Android SDK.
It was replaced with a command line tool named sdkmanager.bat.

Most developers, including new B4A developers, still use a version which does include the GUI interface, as the B4A download page points to an older version.
You can continue to use the currently installed Android tools.

A custom tool named B4A SDK Manager is provided as an alternative for developers who like to upgrade:



Installation instructions:

1. Download the latest sdk tools: https://developer.android.com/studio/index.html#command-tools
2. Create a folder for Android SDK. Don't put it under Program Files as it is a restricted folder. C:\android-sdk is a good option.
3. Unzip the sdk tools and copy the tools library to android sdk folder. It should look similar to:



4. Download B4ASdkManager.jar and double click on it. It requires Java 8u40+ to be installed.
5. Click on the open folder button and select sdkmanager.bat. It will be under <sdk path>\tools\bin
6. Install all recommended items. It can take a few minutes or more.
Licenses agreements will be printed. Read them and approve.
7. Don't forget to update B4A IDE to use the new SDK (Tools - Configure Paths - android.jar).

Next tutorial: AVD Manager / Emulator

The B4J source code is attached. It depends on jShell v1.5+.

Android SDK currently doesn't support Java 9. Make sure that B4A is configured to use Java 8 (Tools - Configure Paths).
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
At this point there is no benefit for upgrading. I assume that it will be mandatory at some point in the future.
On the other hand upgrading to the latest build tools is not more complicated than installing the old version. It is actually simpler as the required items are already selected.
 

William Hunter

Active Member
Licensed User
By clicking on Tools/Run AVD Manager, in B4A, this will open file C:\android-sdk\tools\android.bat. Both android.bat and emulator.exe, are located in the destination tools folder, but the emulator does not run.

I have followed the installation instructions, and all the required elements are in place. How can I run the emulator?

Regards
 

Erel

Administrator
Staff member
Licensed User
When I running B4ASdkManager.jar on MAC OSX , it was crash
This is a Windows program. It is based on the Windows SDK.

I have followed the installation instructions, and all the required elements are in place. How can I run the emulator?
The steps required to create an AVD were not yet implemented in this tool. You can use the command line tool to create an AVD: https://developer.android.com/studio/command-line/avdmanager.html
Then start it with emulator.exe (under Tools folder).
 

William Hunter

Active Member
Licensed User
The steps required to create an AVD were not yet implemented in this tool. You can use the command line tool to create an AVD: https://developer.android.com/studio/command-line/avdmanager.html
Then start it with emulator.exe (under Tools folder).
Thank you Erel. I have this working, although without the emulator. I also had to install Android SDK Platform-Tools in order to compile.

Anyone using Genymotion should be sure to only use emulators based on API 23 or less.

The boys at Google are making us work too hard!!! :(

Regards
 

William Hunter

Active Member
Licensed User
The steps required to create an AVD were not yet implemented in this tool. You can use the command line tool to create an AVD: https://developer.android.com/studio/command-line/avdmanager.html
Then start it with emulator.exe (under Tools folder).
I have tried to create an AVD for the IntelAtomx86 using the instructions at https://developer.android.com/studio/command-line/avdmanager.html But I get this error message: Error: Invalid --tag default for the selected package.

I have attached three image files to show my setup, and the error received in CommandPrompt. I believe that I am setup correctly, and would appreciate any guidance if I am not.

Regards
B4A Sdk Manager.png PathToSystemImage.png CommandPrompt.png
 

rwblinn

Well-Known Member
Licensed User
Tested the B4AManager 1.01, it crashed when older Android versions, like android-L, android-tv ... are installed = Java.Lang.Numberformat exception.
Looked at the B4AManager source and found that the sub ParseItem assigns the Android version as an int.
Solved by following workaround in sub ParseItem:
B4X:
..
If p.StartsWith("android-") Then
  Dim v() As String = Regex.Split("-", p)
  If IsNumber(v(1)) Then si.AndroidVersion = p.SubString("android-".Length)
  Exit
End If
...
 

Erel

Administrator
Staff member
Licensed User
V2.01 is released. It fixes the issue with the non-numeric versions (the fix is a bit more complicated) and also an error with the definition of the tablet AVD.
 

Cebuvi

Active Member
Licensed User
I have followed all the steps in this tutorial, but I get this error. Why?.

sdkmanager_error.jpg

Thanks
 
Top