Android Tutorial GUI SDK Manager for newer versions of Android tools

Status
Not open for further replies.
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:

SS-2017-06-06_12.53.22.png


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:

SS-2017-05-29_15.44.54.png


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

  • B4A-SdkManager-Source.zip
    63.3 KB · Views: 5,044
Last edited:

Jaames

Active Member
Licensed User
Longtime User
Thanks, I'll try later, when I'm home. But it seems to work, I'm on mobile internet here , so I can't download now.

for those , who's B4ASdkManager.jar is located in folder which include space character like mine "E:\B4A\SDK Instalacije"

do like this:

1. Right click on windows icon (win 10 64 bit anniversary update here) and chose "Windows PowerShell(Admin)"
2. In PwerShell type cd "YOUR FOLDER WITH B4ASdkManager.jar" with quotemarks Important ex.: cd "E:\B4A\SDK Instalacije"
3. Then type .\B4ASdkManager.jar


ps.jpg

b4a.jpg

[EDIT]
Or you can copy attached B4ASdkManager.txt file to the same folder where B4ASdkManager.jar is located and rename it to B4ASdkManager.bat and double click to that file. (It will run the .jar file with Administrative rights)

Version 2.10 fixed this issue, I did not have to delete any files, just run B4ASdkManager.jar.
 

Attachments

  • B4ASdkManager.txt
    776 bytes · Views: 572
Last edited:

Alessandro71

Well-Known Member
Licensed User
Longtime User
what about this error:

i get it from B4ASdkManager and from sdkmanager.bat --list also

B4X:
Exception in thread "main" java.lang.NoSuchFieldError: FN_AAPT2
        at com.android.sdklib.BuildToolInfo.<init>(BuildToolInfo.java:352)
        at com.android.sdklib.BuildToolInfo.fromStandardDirectoryLayout(BuildToolInfo.java:224)
        at com.android.sdklib.repository.legacy.local.LocalSdk.scanBuildTools(LocalSdk.java:898)
        at com.android.sdklib.repository.legacy.local.LocalSdk.getPkgsInfos(LocalSdk.java:544)
        at com.android.sdklib.repository.legacy.LegacyLocalRepoLoader.parseLegacyLocalPackage(LegacyLocalRepoLoader.java:100)
        at com.android.repository.impl.manager.LocalRepoLoaderImpl.parsePackages(LocalRepoLoaderImpl.java:167)
        at com.android.repository.impl.manager.LocalRepoLoaderImpl.getPackages(LocalRepoLoaderImpl.java:124)
        at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:517)
        at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:397)
        at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:364)
        at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:290)
        at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.createRepoManager(AndroidSdkHandler.java:718)
        at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:295)
        at com.android.sdklib.tool.SdkManagerCli.<init>(SdkManagerCli.java:134)
        at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:118)
        at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)

B4ASdkManager also adds
Info: Parsing legacy package:
C:\Android\android-sdk\add-ons\addon-google_apis-google-15
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
it seems deleting
tools/lib/common.jar
solved the issue

i followed the first post instructions overwriting an existing sdk installation
 

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

I'm using this tool to get notifications working. I notice it's installing SDK Platform 24 whereas I had 25. Not sure it makes much difference. Question is, will you be updating the "recommended" section regularly?

Also I wasn't sure if I needed a clean install or if I should overwrite my current tools directory. I opted for a clean install. Is that the right approach?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Hello,

Very good work. I'm testing it and I think it will be great if there is a download progress bar by size and files :
eg:
1153kb on 3780Kb
35/123 files

Thanks again.

PS: It's like someone trashes our old good tools. No pity for old ... computers ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm testing it and I think it will be great if there is a download progress bar by size and files :
The packages are downloaded by sdkmanager.bat which is part of Android SDK. It doesn't report any progress so there are no reasonable ways to track the progress (the total size is also unknown).
 

William Hunter

Active Member
Licensed User
Longtime User
V2.20 is released. It fixes an issue with missing updates.
I have installed the new version. When I run the AVD Manager, I get the Java error shown in Image One. Once I close the error message the AVD Manager loads fine, as shown in Image Two, and I can successfully run an emulator. The error message is confusing.

Regards
SDKmanagerOne.png SDKmanagerTwo.png
 

jimmyF

Active Member
Licensed User
Longtime User
I also encountered the same error:

Error occurred on line: 284 (Main)
java.lang.NullPointerException
at b4j.example.main._isinstalled(main.java:1399)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:613)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:19)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:135)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:84)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:482)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:462)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:536)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:748)

on this line:
B4X:
If si.Key = s.Key And si.version = s.version Then Return True
 

jimmyF

Active Member
Licensed User
Longtime User
, version=22, AndroidVersion=21, AndroidVersionForSorting=21
]
IsInstalled: [IsInitialized=false, Key=system-images;android-24;default;x86, description=null
, version=null, AndroidVersion=null, AndroidVersionForSorting=null
], [IsInitialized=true, Key=system-images;android-23;google_apis;x86, description=Google APIs Intel x86 Atom System Image
, version=23, AndroidVersion=23, AndroidVersionForSorting=23
]
IsInstalled: [IsInitialized=false, Key=system-images;android-24;default;x86, description=null
, version=null, AndroidVersion=null, AndroidVersionForSorting=null
], [IsInitialized=true, Key=system-images;android-23;google_apis;x86_64, description=Google APIs Intel x86 Atom_64 System Image
, version=23, AndroidVersion=23, AndroidVersionForSorting=23
]
IsInstalled: [IsInitialized=false, Key=system-images;android-24;default;x86, description=null
, version=null, AndroidVersion=null, AndroidVersionForSorting=null
], [IsInitialized=true, Key=system-images;android-24;default;x86, description=Intel x86 Atom System Image
, version=8, AndroidVersion=24, AndroidVersionForSorting=24
]
Error occurred on line: 291 (Main)
java.lang.NullPointerException
at b4j.example.main._isinstalled(main.java:1402)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:613)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:19)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:135)
 
Status
Not open for further replies.
Top