Android Question Problems connecting to the WEB server MySQL

Lakhtin_V

Active Member
Licensed User
Longtime User
Previously time, everything worked fine, I did not make any changes regarding the connection to the WEB server. On my Xiaomi MUI13 smartphone, the version is SDK 31. The smartphone updated could this be the cause of the failure?
Error mesage:
** Activity (setup) Resume **
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.BA.setLastException(java.lang.Exception)' on a null object reference
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1719)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:210)
    at android.os.Looper.loop(Looper.java:299)
    at android.app.ActivityThread.main(ActivityThread.java:8168)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1037)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.BA.setLastException(java.lang.Exception)' on a null object reference
    at b4a.example.clswebserver$ResumableSub_WEBconect.resume(clswebserver.java:578)
    at b4a.example.clswebserver._vvvvvvvvvvv3(clswebserver.java:360)
    at b4a.example.setup$ResumableSub_Activity_Create.resume(setup.java:432)
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1717)
    ... 8 more
1667665406280.png
 

Lakhtin_V

Active Member
Licensed User
Longtime User
Remove the Try / Catch blocks. Which error happens?

The error appears on the new smartphones Samsung Galaxy A51 Android 12 and Xiaomi Redmi Not 10 Pro Android 12
On older models everything is OK
 

Attachments

  • 1667738033981.png
    1667738033981.png
    98.3 KB · Views: 120
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
Please post the logs as text. Right click to copy.
I suspect that the problem is not with MySQL in Internet. The problem is in the local database light SQL. More specifically, when deleting the old version of the application, the file with the settings inside the light SQL database is not erased. And on older smartphones everything works correctly. Probably there is a difference in the real location of the files in the new 12 version of Android. How can I ensure that all information is cleared after deleting the trial version of the application in Android 12?

Error SQL:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
----  RESUME  ----
Starter AudioStreamer run...
Audio Streamer starting....in Main
Starter GPS run...
GPS starting....in Main
SDK version 31
Ширина 2.454545259475708  Main --> Setup
** Activity (main) Pause, UserClosed = false **
(Exception) Not initialized
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Activity (setup) Create, isFirst = true **
setup_readdevice (java line: 723)
java.lang.IllegalArgumentException: column 'OFFset' does not exist. Available columns: [IDdevice, Grupa, IMEI, Nick, Lat, Lon, DeltaT, DeltaV, Cur]
    at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:358)
    at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:377)
    at b4a.example.setup._readdevice(setup.java:723)
    at b4a.example.setup._activity_create(setup.java:388)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at b4a.example.setup.afterFirstLayout(setup.java:105)
    at b4a.example.setup.access$000(setup.java:17)
    at b4a.example.setup$WaitForLayout.run(setup.java:83)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:210)
    at android.os.Looper.loop(Looper.java:299)
    at android.app.ActivityThread.main(ActivityThread.java:8168)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1037)

If I understand correctly, a failure occurs when accessing the old version of the configuration file, and the new version does not take the place of the old one.
Replace file:
    If File.Exists(File.DirInternal,"noise.db")=False Then
        File.Copy(File.DirAssets,"noise.db",File.DirInternal,"noise.db")
    End If
 
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
the new version does not take the place of the old one
The new version is not copied, because File.Exists(File.DirInternal,"noise.db") = TRUE, so you're not copying the new file.
Comment (just for one time) the lines 1 and 3 to "force" the new file to be copied.

B4X:
    'If File.Exists(File.DirInternal,"noise.db")=False Then '<----- Comment and remove the ' later
        File.Copy(File.DirAssets,"noise.db",File.DirInternal,"noise.db")
    'End If '<----- Comment
 
Last edited:
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
The new version is not copied, because File.Exists(File.DirInternal,"noise.db") = TRUE, so you're not copying the new file.
Comment (just for one time) the lines 1 and 3 to "force" the new file to be copied.

B4X:
    'If File.Exists(File.DirInternal,"noise.db")=False Then '<----- Comment and remove the ' later
        File.Copy(File.DirAssets,"noise.db",File.DirInternal,"noise.db")
    'End If '<----- Comment
I understand your advice, but the problem is deeper, after deleting the application in Android 12, the settings file "noise.db" is not actually deleted, so the problem arises. maybe you need check a different location for android 12?
 
Upvote 0
Top