Android Question FTP not working - using Net library 1.53

devragland

Member
Licensed User
Longtime User
hi,


my b4a version is v 2.00, i'am trying to upload text files to a windows FTP server, it compiles fine
but when i deploy it to a emulator or a real device the program throws up an error "unfortunately the program has stopped" and exits.
please check the code and log below.

here is the code i've used.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
Dim FTP As FTP
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("up")
Activity.Title="HOME"
If FirstTime Then
FTP.Initialize("FTP","172.17.1.71",21,"ftpuser","ftp123")
FTP.List("/")
End If

 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    Log(ServerPath)
    If Success = False Then
        Log(LastException)
    Else
        For i = 0 To Folders.Length - 1
            Log(Folders(i).Name)
        Next
        For i = 0 To Files.Length - 1
            Log(Files(i).Name & ", " & Files(i).Size & ", " & DateTime.Date(Files(i).Timestamp))
        Next
    End If
End Sub


and the log errors.

B4X:
LogCat connected to: emulator-5554
problem reading network stats
java.lang.IllegalStateException: problem parsing idx 1
    at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:300)
    at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1282)
    at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:831)
    at com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:743)
    at com.android.server.net.NetworkStatsService.updateIfaces(NetworkStatsService.java:721)
    at com.android.server.net.NetworkStatsService.access$000(NetworkStatsService.java:128)
    at com.android.server.net.NetworkStatsService$8.handleMessage(NetworkStatsService.java:1633)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:137)
    at android.os.HandlerThread.run(HandlerThread.java:60)
Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:406)
    at java.io.FileInputStream.<init>(FileInputStream.java:78)
    at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:269)
    ... 9 more
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:390)
    ... 11 more
problem reading network stats
java.lang.IllegalStateException: problem parsing idx 1
    at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:300)
    at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1282)
    at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:831)
    at com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:743)
    at com.android.server.net.NetworkStatsService.updateIfaces(NetworkStatsService.java:721)
    at com.android.server.net.NetworkStatsService.access$000(NetworkStatsService.java:128)
    at com.android.server.net.NetworkStatsService$1.onReceive(NetworkStatsService.java:612)
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.os.HandlerThread.run(HandlerThread.java:60)
Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:406)
    at java.io.FileInputStream.<init>(FileInputStream.java:78)
    at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:269)
    ... 11 more
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:390)
    ... 13 more
main_process_globals (java line: 365)
java.lang.NoClassDefFoundError: anywheresoftware.b4a.net.FTPWrapper
    at ftp.upload.main._process_globals(main.java:365)
    at ftp.upload.main.initializeProcessGlobals(main.java:335)
    at ftp.upload.main.afterFirstLayout(main.java:80)
    at ftp.upload.main.access$100(main.java:16)
    at ftp.upload.main$WaitForLayout.run(main.java:72)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4424)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)
 

Attachments

  • upload.zip
    6.6 KB · Views: 141

DonManfred

Expert
Licensed User
Longtime User
I´m using B4A 3.82, same Net-library. Using my credentials on my ftp your code works fine here...
 
Upvote 0

devragland

Member
Licensed User
Longtime User
could it be that the net library is not compatible with v 2.00 of b4a? the log errors seem to be throwing up exceptions related to the ftp lib. any help with uploading files with my particular version of b4a would be helpful in case ftp is a no go.
 
Upvote 0

devragland

Member
Licensed User
Longtime User
Erel: i understand, we're only targeting older devices running on android version 4.0.3 or below. is there a way to upload files with the current version of b4a? other than FTP? i would appreciate it if you would point me in the right direction.

p.s. upgrading b4a would take a bit of time for me.
 
Upvote 0

devragland

Member
Licensed User
Longtime User
thanks for the quick reply, so httputils2 is compatible with my version v2.00 of b4a? i downloaded HttpUtils2 version 2.01 which is for a newer version i think?

and also. would the ftp library 1.3.0 work for v2.0.0 of b4a? i couldnt find the download links except for 1.5.3

and help is much appreciated.

Edit: my webserver is a LAMP stack with php installed.
 
Upvote 0
Top