Problem with application from B4A v1.90 to B4A v2.00

psdos

Active Member
Licensed User
Longtime User
I have a problem with my code when i update to B4A v2.00. I use HttpUtils and in my Main program have this code for ProgressStatus

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim hc As HttpClient
   Dim req As HttpRequest
   Type ProgressStatus(Downloaded As Long, Total As Long)
   
End Sub

Sub ProgressHTTP(tmp As ProgressStatus)
    'Label7.Text = tmp.Downloaded & " / " & tmp.Total
    ProgressBar1.progress = Round((tmp.Downloaded * 100)/tmp.Total)
End Sub

In HttpUtils there is this command too in

B4X:
'Version 1.04
Sub Process_Globals
   Dim Tasks As List 'List of URLs to fetch.
   'A map that holds the successful links.
   'The links are stored as keys. The values are not used.
   Dim SuccessfulUrls As Map 
   Dim Working As Boolean 'True when a job is still running
   Dim Complete As Boolean 'True after a job has completer
   Dim Job As String 'Name of the current running Job
   Dim CallbackActivity As String 'Name of Activity that handles the callbacks.
   Dim CallbackJobDoneSub As String 'Name of the JobDone callback sub.
   Dim CallbackUrlDoneSub As String 'Name of the UrlDone callback sub.
   Dim CallbackProgressSub As String 'download progress of file
   Type ProgressStatus(Downloaded As Long,Total As Long)
End Sub

when i complile give this error

Compiling code. Error
Error parsing program.
Error description: Ya se agregó un elemento con la misma clave.
Occurred on line: 14
Type ProgressStatus(Downloaded As Long,Total As Long)

the error is in HttpUtils, someone has any solution for this error?

Thanks.
 

psdos

Active Member
Licensed User
Longtime User
If i remove it in Main or in HttpUtils program not start.... in B4A v1.90 this is full ok.
 
Upvote 0

psdos

Active Member
Licensed User
Longtime User
Application not start and it crash at the seconds and application is closed. It if i remove this declaration in Main for example...
 
Upvote 0

psdos

Active Member
Licensed User
Longtime User
Nothing, it do not start, i remove this line from Main first and save, exit and reload proyect, no errors in compile, but application dont start, after i remove the line in HttpUtils modul and same error, application dont start and crash. I think that is a problem HttpUtils?

Thanks Erel for you support but i dont can upload my proyect for analisys, is a industrial proyect with (c). To be continued use B4A v1.90.
 
Upvote 0

psdos

Active Member
Licensed User
Longtime User
In Logs dont show details of fails..., one details more, i probe B4A v1.92 and remove line in HttpUtils, and it start ok. I think that problems can is in B4A v2.00
 
Upvote 0

psdos

Active Member
Licensed User
Longtime User
I confirm that if i compile my application in B4A v2.00 it crach, and quickcly show in screen from my Galaxy Note, libcore error, in B4A v1.92 all go ok

Here my LOGs, first compile how Release and after compile in debug mode, in the two program crash at few seconds.

B4X:
LogCat connected to: B4A-Bridge: samsung GT-N7000-XXXXXXXXXXXXXXXX
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:Bustagena.eng
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 329)
java.lang.NoSuchFieldError: anywheresoftware.b4a.BA.activityBA
   at anywheresoftware.b4a.phone.Phone.SetScreenOrientation(Phone.java:192)
   at Bustagena.eng.main._activity_create(main.java:329)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   at Bustagena.eng.main.afterFirstLayout(main.java:84)
   at Bustagena.eng.main.access$100(main.java:16)
   at Bustagena.eng.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:4507)
   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:980)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
   at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:Bustagena.eng
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 172)
Phone1.SetScreenOrientation(1) 'Aquí forzamos a que el equipo este solo en la orientación vertical
java.lang.NoSuchFieldError: anywheresoftware.b4a.BA.activityBA
   at anywheresoftware.b4a.phone.Phone.SetScreenOrientation(Phone.java:192)
   at Bustagena.eng.main._activity_create(main.java:334)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   at Bustagena.eng.main.afterFirstLayout(main.java:84)
   at Bustagena.eng.main.access$100(main.java:16)
   at Bustagena.eng.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:4507)
   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:980)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
   at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
 
Last edited:
Upvote 0

mdk

Member
Licensed User
Longtime User
Hello community, I also have problems with the new version. I updated from 1.92 to 2.0. When compiling my older projects I get the following error message:
B4X:
Compiling code.                         0.06
Compiling layouts code.                 0.00
Generating R file.                      0.00
Compiling generated Java code.          Error
java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main" Could not find the main class: com.sun.tools.javac.Main.  Program will exit.
My folder for additional libs is empty. Then I created a new project from scratch just by starting the B4A IDE. Here I get the same error message. Then I deinstalled B4A and installed it totally new. Then I get the same error message. Can somebody help me please.
Best regards mdk
 
Upvote 0

mdk

Member
Licensed User
Longtime User
Hi Erel,
checked and reconfigured the path again, here is my setting
C:\Utils\jdk1.6.0_26\bin\javac.exe
C:\Utils\Android-sdk\platforms\android-8\android.jar
C:\Utils\Basic4androidLibs
I'm using W7 64 Bit, can this be a problem.? With version 1.92 everything is fine.
Best regards
mdk
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
subscribed

Subscribed for results , Goo to know that http wasn't the issue for O.P.

hanging on for more info on additional problem that was hijacked into this thread :(
 
Upvote 0

psdos

Active Member
Licensed User
Longtime User
You have an old version of Phone library in your additional libraries path. You should delete it.

The internal one is newer and will work fine.


Erel, excellent as always your support, this was indeed the problem. Thank you very much.
 
Upvote 0

mdk

Member
Licensed User
Longtime User
Hi Erel,
I have followed your instructions, now everything works fine, many thanks.
Best regards
mdk
 
Upvote 0
Top