Android Tutorial GUI SDK Manager for newer versions of Android tools

Erel

Administrator
Staff member
Licensed User
Can you run the B4J project with a breakpoint in line 193 and see the values of StdOut and StdErr?
 

Erel

Administrator
Staff member
Licensed User
V2.05 is released. It fixes the error described in post #22.
 

jimmyF

Active Member
Licensed User
I get this error when I click on AVD Manager:

B4X:
Error occurred on line: 122 (AVDManager)
java.lang.ArrayIndexOutOfBoundsException: 8
    at b4j.example.avdmanager._parseitem(avdmanager.java:1620)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
etc.
This is line 122 mentioned above:
I am not familiar enough with RegEx protocols to spot the actual error in that line of code.
B4X:
Dim m As Matcher = Regex.Matcher("\s+([^:]+):(.*)", Lines(i))
Anybody else run into this problem? Or anyone know the solution?
Thanks
 

Erel

Administrator
Staff member
Licensed User
Please replace the ParseItem code with this sub:
B4X:
Sub ParseItem(Index() As Int, Lines() As String) As AVD 'ignore
   Dim AV As AVD
   AV.Initialize
   Dim i As Int = Index(0)
   Do While i < Lines.Length
     Log(Lines(i))
     Dim m As Matcher = Regex.Matcher("\s+([^:]+):(.*)", Lines(i))
     If m.Find Then
       Dim field As String = m.Group(1).Trim
       Dim value As String = m.Group(2).Trim
       If field = "Name" Then
         AV.Name = value
       Else If field = "Target" Then
         If value.Length = 0 Then
           value = Lines(i + 1).Trim
         End If
         AV.Target = value
       End If
     Else
       Exit
     End If
     i = i + 1
   Loop
   Index(0) = i - 1
   Return AV
End Sub
Does it work? If not please post the output logs.
 

Erel

Administrator
Staff member
Licensed User
When you say that it works, you mean that you see the list of AVDs, right?
 

jimmyF

Active Member
Licensed User
Yes, I see a list of a grand total of one.
I have installed other platforms and x86 images but I only display one in the list.
Platform 24
Nexus_6P_API_25_b4A

Log:
Name: Nexus_6P_API_25_B4A
Device: Nexus 6P (Google)
Path: C:\Users\James.SEF2\.android\avd\Nexus_6P_API_25_B4A.avd
Target: Google APIs
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
Skin: nexus_6p
Sdcard: 100M

My SDK is here:
E:\Android\sdk\
 

jimmyF

Active Member
Licensed User
My only choice of Platform is Platform 24.
I have 25 and 26 installed.
Okay, I can create a new one:
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
Skin: nexus_6p
 

jimmyF

Active Member
Licensed User
This is what I have installed:

DataFolder: C:\Users\James.SEF2\AppData\Roaming\B4ASdkManager
add-ons;addon-google_apis-google-19
build-tools;25.0.2
build-tools;25.0.3
build-tools;26.0.0
cmake;3.6.3155560
docs
emulator
extras;android;gapid;3
extras;android;m2repository
extras;google;auto
extras;google;google_play_services
extras;google;instantapps
extras;google;m2repository
extras;google;market_apk_expansion
extras;google;market_licensing
extras;google;play_billing
extras;google;simulators
extras;google;usb_driver
extras;google;webdriver
extras;intel;Hardware_Accelerated_Execution_Manager
extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1
extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2
extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2
patcher;v1
patcher;v4
platform-tools
platforms;android-24
platforms;android-25
platforms;android-26
sources;android-24
sources;android-25
system-images;android-17;default;x86
system-images;android-17;google_apis;x86
system-images;android-18;google_apis;x86
system-images;android-21;default;x86
system-images;android-21;default;x86_64
system-images;android-21;google_apis;x86
system-images;android-21;google_apis;x86_64
system-images;android-24;default;x86
system-images;android-24;default;x86_64
system-images;android-24;google_apis;x86
system-images;android-24;google_apis;x86_64
system-images;android-24;google_apis_playstore;x86
system-images;android-25;android-tv;x86
system-images;android-25;android-wear;armeabi-v7a
system-images;android-25;android-wear;x86
system-images;android-25;google_apis;x86
system-images;android-25;google_apis;x86_64
system-images;android-26;google_apis;x86
system-images;android-26;google_apis_playstore;x86
tools
 

iz0ndg

Member
Licensed User
Hi, i have this error to install selected :
B4X:
Warning: An error occurred while preparing SDK package Android Support Repository: C:\Windows\PackageOperation01\android_m2repository_r47.zip.
java.nio.file.NoSuchFileException: C:\Windows\PackageOperation01\android_m2repository_r47.zip
   at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
   at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
   at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
   at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
   at java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source)
   at java.nio.file.Files.newOutputStream(Unknown Source)
   at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:247)
   at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:235)
   at com.android.sdklib.repository.legacy.LegacyDownloader.downloadFully(LegacyDownloader.java:82)
   at com.android.repository.impl.installer.BasicInstaller.doPrepare(BasicInstaller.java:71)
   at com.android.repository.impl.installer.AbstractPackageOperation.prepare(AbstractPackageOperation.java:243)
   at com.android.sdklib.tool.SdkManagerCli.applyPackageOperation(SdkManagerCli.java:523)
   at com.android.sdklib.tool.SdkManagerCli.installPackages(SdkManagerCli.java:357)
   at com.android.sdklib.tool.SdkManagerCli.run(SdkManagerCli.java:147)
   at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:119)
   at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)
sdkmanager.bat : C:\android-sdk\tools\bin\sdkmanager.bat

on Win7 32bit java 8u131
 

Jaames

Active Member
Licensed User
Hi, i have this error to install selected :
B4X:
Warning: An error occurred while preparing SDK package Android Support Repository: C:\Windows\PackageOperation01\android_m2repository_r47.zip.
java.nio.file.NoSuchFileException: C:\Windows\PackageOperation01\android_m2repository_r47.zip
   at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
   at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
   at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
   at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
   at java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source)
   at java.nio.file.Files.newOutputStream(Unknown Source)
   at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:247)
   at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:235)
   at com.android.sdklib.repository.legacy.LegacyDownloader.downloadFully(LegacyDownloader.java:82)
   at com.android.repository.impl.installer.BasicInstaller.doPrepare(BasicInstaller.java:71)
   at com.android.repository.impl.installer.AbstractPackageOperation.prepare(AbstractPackageOperation.java:243)
   at com.android.sdklib.tool.SdkManagerCli.applyPackageOperation(SdkManagerCli.java:523)
   at com.android.sdklib.tool.SdkManagerCli.installPackages(SdkManagerCli.java:357)
   at com.android.sdklib.tool.SdkManagerCli.run(SdkManagerCli.java:147)
   at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:119)
   at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)
sdkmanager.bat : C:\android-sdk\tools\bin\sdkmanager.bat

on Win7 32bit java 8u131
Almost the same here, Windows 10 64, java 8u131
I deleted old sdk and Android Studio, witch was about 35Gb , and downloaded sdk tools from the OP link

B4X:
Info: Parsing E:\Android\sdk\tools\package.xml
Info: Parsing E:\Android\sdk\tools\package.xml
Info: Preparing "Install Android Support Repository (revision: 47.0.0)".
Info: "Install Android Support Repository (revision: 47.0.0)" failed.

Warning: File C:\Users\james\.android\repositories.cfg could not be loaded.
Warning: An error occurred while preparing SDK package Android Support Repository: C:\WINDOWS\PackageOperation01\android_m2repository_r47.zip.
java.nio.file.NoSuchFileException: C:\WINDOWS\PackageOperation01\android_m2repository_r47.zip
    at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
    at java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source)
    at java.nio.file.Files.newOutputStream(Unknown Source)
    at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:247)
    at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:235)
    at com.android.sdklib.repository.legacy.LegacyDownloader.downloadFully(LegacyDownloader.java:82)
    at com.android.repository.impl.installer.BasicInstaller.doPrepare(BasicInstaller.java:71)
    at com.android.repository.impl.installer.AbstractPackageOperation.prepare(AbstractPackageOperation.java:243)
    at com.android.sdklib.tool.SdkManagerCli.applyPackageOperation(SdkManagerCli.java:523)
    at com.android.sdklib.tool.SdkManagerCli.installPackages(SdkManagerCli.java:357)
    at com.android.sdklib.tool.SdkManagerCli.run(SdkManagerCli.java:147)
    at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:119)
    at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)
 

Erel

Administrator
Staff member
Licensed User
@Jaames and @iz0ndg, please add this line to the source code and post its output:
B4X:
Log(GetSystemProperty("java.io.tmpdir", "NA"))
My only choice of Platform is Platform 24.
There are no system images available for API 25 or 26 (the main one is missing. It is also missing here).
 

iz0ndg

Member
Licensed User
All log after 'Install Selected':
B4X:
DataFolder: C:\Users\fabio\AppData\Roaming\B4ASdkManager
C:\Users\fabio\AppData\Local\Temp\
tools
tools
In Panel :

B4X:
Info: Parsing C:\android-sdk\tools\package.xml
Info: Parsing C:\android-sdk\tools\package.xml

Warning: An error occurred while preparing SDK package Android Support Repository: C:\Windows\PackageOperation01\android_m2repository_r47.zip.
java.nio.file.NoSuchFileException: C:\Windows\PackageOperation01\android_m2repository_r47.zip
   at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
   at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
   at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
   at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
   at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
   at java.nio.file.Files.newOutputStream(Files.java:216)
   at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:247)
   at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:235)
   at com.android.sdklib.repository.legacy.LegacyDownloader.downloadFully(LegacyDownloader.java:82)
   at com.android.repository.impl.installer.BasicInstaller.doPrepare(BasicInstaller.java:71)
   at com.android.repository.impl.installer.AbstractPackageOperation.prepare(AbstractPackageOperation.java:243)
   at com.android.sdklib.tool.SdkManagerCli.applyPackageOperation(SdkManagerCli.java:523)
   at com.android.sdklib.tool.SdkManagerCli.installPackages(SdkManagerCli.java:357)
   at com.android.sdklib.tool.SdkManagerCli.run(SdkManagerCli.java:147)
   at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:119)
   at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)
 
Last edited:

A Z M JANNAT UL KARIM

Member
Licensed User
Hi, using windows 10 here, right click on Start Menu gives you another pop up menu from where you can select Windows PowerShell(Admin). UAC Popup dialog will appear, select Yes. Now suppose you downloaded the Jar file to D: Drive. Write in the PowerShell cd d: and press enter. Now write there B4ASdkManager.jar and hit enter. It will run the JAR file and you can install from there. Hope this will solve your issue.
 
Top