Android Tutorial GUI SDK Manager for newer versions of Android tools

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

  1. jimmyF

    jimmyF Active Member Licensed User

    Works just fine now! :)
     
  2. jose luis gudino

    jose luis gudino Member Licensed User

    This is excellent
     
  3. jose luis gudino

    jose luis gudino Member Licensed User

    Excelente Herramienta...
    Tool Excelent ..
     
  4. DX94

    DX94 New Member

    Hello, I am trying to port the tool to linux, As far as I reached it finds sdkmanager but now returns an error saying "Error: bash: /c: No such file or directory"

    found the code the error comes from in CreateSdkManagerExec, and have a question
    What is that "/c" for?
    Code:
    allArgs.AddAll(Array("/c", txtPathToSdkManager.Text, "--verbose"))
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    B4A SDK Manager will only work on Windows.

    The /c is an argument to cmd.exe. It is used to run batch files.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    V2.22 is released. The Android SDK tools will use the Java set in B4A IDE (if exists).

    Android SDK doesn't yet support Java 9. Make sure that B4A is configured with Java 8.
     
    lemonisdead likes this.
  7. jimmyF

    jimmyF Active Member Licensed User

  8. Erel

    Erel Administrator Staff Member Licensed User

    Did it previously work? Can you run the source code from B4J and see where it fails?
     
  9. jimmyF

    jimmyF Active Member Licensed User

    Yes, it did previously work.
    In the code:
    Log: Error occurred on line: 301 (Main)
    Log: java.lang.RuntimeException: Object should first be initialized (List).

    So I add code to initialize and the next error is as follows:

    Log: Error occurred on line: 337 (Main)
    Log: java.lang.ArrayIndexOutOfBoundsException: 1278

    I tried to change the upper bound of the index but that failed to correct the problem.
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Add Log(Line) in line #279:
    Code:
    Dim line As String = lines(index(0))
    Log(line) '<-----
    What is the output?

    I don't think that this error is related to the change in the latest version.
     
  11. jimmyF

    jimmyF Active Member Licensed User

     
  12. Erel

    Erel Administrator Staff Member Licensed User

    Please revert any changes you made except of the Log(line) call and post it again.
     
  13. jimmyF

    jimmyF Active Member Licensed User

    Done

     
  14. Erel

    Erel Administrator Staff Member Licensed User

    Thank you.
    Might be an encoding issue.

    Please change ParseListResult code to:
    Code:
    Sub ParseListResult (StdOut As String)
       
    Dim lines() As String = Regex.Split2("\r\n"Regex.MULTILINE, StdOut)
       
    Dim index(1As Int
       
    Dim CurrentMap As List
       
    Dim InAvailableItems As Boolean
       
    Do While index(0) < lines.Length
         
    Dim line As String = lines(index(0))
         
    If line.StartsWith("-------"Then
           
    Log(lines(index(0) - 1)) '<--- breakpoint here
           Select lines(index(0) - 1).Trim
             
    Case "Installed packages:"
               CurrentMap = InstalledItems
               InAvailableItems = 
    False
             
    Case "Available Packages:"
               CurrentMap = AvailableItems
               InAvailableItems = 
    True
             
    Case "Available Updates:"
               InAvailableItems = 
    False
               CurrentMap = UpdateableItems
           
    End Select
         
    Else
           
    If line = "done" Then Exit
           
    If line.Length > 0 Then
             
    Dim c As String = line.CharAt(0)
             
    If c.ToUpperCase <> c Then
               
    Dim si As SdkItem = ParseItem(index, lines)
               
    If Not(InAvailableItems And IsInstalled(si, True)) Then
                 
    If RecommendedSet.ContainsKey(si.Key) And InAvailableItems Then
                   RecommendedItems.Add(si)
                 
    Else
                   CurrentMap.Add(si)
                 
    End If
               
    End If
             
    End If
           
    End If
         
    End If
         index(
    0) = index(0) + 1
       
    Loop
    End Sub
    Click on F8 to let it continue step by step. Does it reach the correct case:
    [​IMG]
    ?

    What is printed from this line:
    Log(lines(index(0) - 1))

    ?
     
  15. jimmyF

    jimmyF Active Member Licensed User

    If I stop and print that line only I get this:
    Then if I continue from that line the result is as follows:

     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Put a breakpoint in line 280 and then click on F8:

    [​IMG]

    Does it go to the correct case block?
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    I guess that it doesn't match the string with "Installed packages:" for some reason. Maybe there is a non-visible character.

    You can add this code after line 279:
    Code:
    Dim s As String = lines(index(0) - 1)
    Log("s: " & s)
    Log(s.Length)
    Log(s = "Installed packages:")
     
  18. jimmyF

    jimmyF Active Member Licensed User

    No. It goes to the bottom of the loop.
    Code:
    index(0) = index(0) + 1
    And I get this:
    Then the error:
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    Thank you. I've released v2.23. I believe that it will fix this issue.
     
    jimmyF likes this.
  20. jimmyF

    jimmyF Active Member Licensed User

    Runs fine but the app log is as follows:
    Actually, the file C:\Users\James.SEF2\.android\repositories.cfg does not exist in that folder
     
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