Android Question Compilation Error

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi, here is my code.

I'm using b4a version 9.50 with Net Library 1.8 in default folder.

FTP.Upload multiple files:
For i =0 To Qty-1
            
            Cursor1.Position=i   
            
        
            FileName=Cursor1.GetString("VoiceMessageFileName")
        
            If FileName<>"" Then
        
                If File.Exists(File.DirRootExternal,FileName) Then
            
                    RecordID=Cursor1.GetInt("ID")                   
                    Dim sf As Object =FTP.UploadFile(File.DirRootExternal, FileName, False, FileName)
                                        
                    Wait For (sf) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
                    If Success Then
                        Log("VM file was uploaded successfully")
                    Else
                        Log("Error uploading VM file")
                    End If
                    
                End If
            End If
            
        Next

Here is my compilation error

B4A Version: 9.50
Java Version: 8
Parsing code. (0.13s)
Building folders structure. (0.02s)
Compiling code. (0.24s)
Compiling layouts code. (0.02s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. (1.74s)
Compiling generated Java code. Error
B4A line: 546
Dim sf As Object =FTP.UploadFile(File.DirRoot
javac 1.8.0_40
src\alex\HCMS\Timesheet\nursenotesnew.java:1324: error: incompatible types: void cannot be converted to Object
_sf = parent._ftp.UploadFile(processBA,anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),parent.mostCurrent._filename,anywheresoftware.b4a.keywords.Common.False,parent.mostCurrent._filename);
^
If I use this code

FTP.Upload multiple files without wait:
For i =0 To Qty-1
            
            Cursor1.Position=i   
            
        
            FileName=Cursor1.GetString("VoiceMessageFileName")
        
            If FileName<>"" Then
        
                If File.Exists(File.DirRootExternal,FileName) Then
            
                    RecordID=Cursor1.GetInt("ID")                   
                    'Dim sf As Object =FTP.UploadFile(File.DirRootExternal, FileName, False, FileName)
                                        
                    'Wait For (sf) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
                    'If Success Then
                    '    Log("VM file was uploaded successfully")
                    'Else
                    '    Log("Error uploading VM file")
                    'End If
                    
                    FTP.UploadFile(File.DirRootExternal, FileName, False, FileName)
                    Sleep(4000)
                    
                End If
            End If
            
        Next

compilation works fine without error.


Please advise.

Thanks
 

Alex_197

Well-Known Member
Licensed User
Longtime User
Problem solved.
I removed Net library jar/xml files from default library folder and put them into additional library folder.

But they were in default library folder since I installed b4a on my computer.


Correction.

Net library files that were installed with b4a 9.5

Net.jar 219261 12/04/2019 13.37
Net.xml 28984 12/04/2019 13.37

Net library files that were downloaded as Net.zip file from this web site

Net.jar 220835 10/04/2018 13:03
Net.xml 28984 10/03/2018 10:09

The weird thing is that if I replaced Net library files that were installed along with b4a 9.5 with files from Net zip files in additional library folder compilation works fine.
If I use original files in additional library folder that were installed along with b4a 9.5 - I'm getting error.

And b4a library panel shows Net library version as 1.8
 
Last edited:
Upvote 0
Top