Hello.
I'm trying to use jShell to send adb commands to android devices. This is the string I'm using as arguments: backup -f "C:\Users\Bike Stop\Documents\b4j\ADBBackup\Objects\bkp\8_19_231_12_40_51_bkp.ab" -apk -shared -all -nosystem. When I copy this string to a command prompt screen it works, but throug b4j it triggers "adb help" command.
This is the code:
This code works OK:
For sure there is a mistake of mine somewhere. I also tried the List approach with same results.
I'm trying to use jShell to send adb commands to android devices. This is the string I'm using as arguments: backup -f "C:\Users\Bike Stop\Documents\b4j\ADBBackup\Objects\bkp\8_19_231_12_40_51_bkp.ab" -apk -shared -all -nosystem. When I copy this string to a command prompt screen it works, but throug b4j it triggers "adb help" command.
This is the code:
B4X:
Dim CMD As Shell
Dim args As String
args = "backup"
If chkSaveFolder.Checked Then
If txtSaveFolder.Text <> "" Then
Dim date As String = DateTime.GetMonth(DateTime.Now) & "_" & DateTime.GetDayOfMonth(DateTime.Now) & "_" & DateTime.GetDayOfYear(DateTime.Now)
Dim time As String = DateTime.GetHour(DateTime.Now) & "_" & DateTime.GetMinute(DateTime.Now) & "_" & DateTime.GetSecond(DateTime.Now)
Dim fullPath As String = txtSaveFolder.Text
If fullPath.EndsWith("\") Then
fullPath = fullPath & date & "_" & time & "_bkp.ab"
Else
fullPath = fullPath & "\" & date & "_" & time & "_bkp.ab"
End If
args = args & " -f " & $""PathToReplace""$
args = args.Replace("PathToReplace", fullPath)
End If
If chkSaveApks.Checked Then
args = args & " -apk"
Else
args = args & " -noapk"
End If
If chkSaveShared.Checked Then
args = args & " -shared"
Else
args = args & " -noshared"
End If
args = args & " -all"
If chkSaveSystem.Checked Then
args = args & " -system"
Else
args = args & " -nosystem"
End If
Else
args = args & " -all"
End If
CMD.Initialize("CMD", "adb", Array As String(args))
CMD.WorkingDirectory = ModMain.APP_PATH
CMD.Run(100000)
This code works OK:
B4X:
Dim CMD As Shell
CMD.Initialize("CMD", "adb", Array As String("devices") )
CMD.WorkingDirectory = ModMain.APP_PATH
CMD.Run(100000)
For sure there is a mistake of mine somewhere. I also tried the List approach with same results.