Android Tutorial GUI SDK Manager for newer versions of Android tools

Discussion in 'Tutorials & Examples' started by Erel, May 29, 2017.

  1. Erel

    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:

    [​IMG]

    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:

    [​IMG]

    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).
     

    Attached Files:

    Last edited: Dec 20, 2017
    somed3v3loper, JohnC, fredo and 27 others like this.
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. Peter Simpson

    Peter Simpson Expert Licensed User

    This is excellent @Erel...
     
    Last edited: May 30, 2017
  4. Erel

    Erel Administrator Staff Member Licensed User

    V1.01 released. The list of recommended items is now downloaded from b4x.com to allow updating it.
     
    BitsAndBytes and Peter Simpson like this.
  5. An Schi

    An Schi Well-Known Member Licensed User

    What is the benefit of upgrading and the downside of using the old version?
     
  6. Erel

    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.
     
  7. little3399

    little3399 Active Member Licensed User

  8. William Hunter

    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
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    This is a Windows program. It is based on the Windows SDK.

    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 likes this.
  10. little3399

    little3399 Active Member Licensed User

    But it can run very well in Ubuntu ...
     
  11. William Hunter

    William Hunter Active Member Licensed User

    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
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    I've added it to the recommended items in v1.01.
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    I've tested it on a Mac here and it does show properly. Have you tried to run it by double clicking on the jar?
     
  14. William Hunter

    William Hunter Active Member Licensed User

    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
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    I plan to add support for emulators to B4A SdkManager next week.
     
  16. PABLO2013

    PABLO2013 Active Member Licensed User

  17. Erel

    Erel Administrator Staff Member Licensed User

  18. rwblinn

    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:
    Code:
    ..
    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, inakigarm and lemonisdead like this.
  19. Erel

    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.
     
    rwblinn likes this.
  20. Cebuvi

    Cebuvi Active Member Licensed User

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

    sdkmanager_error.jpg

    Thanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice