Android Question Android 5.0.1 and Legacy debugger

SteveTerrell

Active Member
Licensed User
B4A 4.00 Beta 1, bridge 2.12

When I run my program under the legacy debugger or as release i get
B4X:
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:trs.ResistanceMeter
maininitializeProcessGlobals (java line: 3185)
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to read from field 'trs.ResistanceMeter.main trs.ResistanceMeter.trsbluetoothservice._main' on a null object reference
    at trs.ResistanceMeter.main.initializeProcessGlobals(main.java:3185)
    at trs.ResistanceMeter.main.afterFirstLayout(main.java:94)
    at trs.ResistanceMeter.main.access$100(main.java:16)
    at trs.ResistanceMeter.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to read from field 'trs.ResistanceMeter.main trs.ResistanceMeter.trsbluetoothservice._main' on a null object reference
    at trs.ResistanceMeter.trsbluetoothservice._process_globals(trsbluetoothservice.java:1862)
    at trs.ResistanceMeter.main.initializeProcessGlobals(main.java:3177)
    ... 11 more
** Activity (main) Resume **
Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
Under the rapid debugger it at least runs but i still get the "Setting" message about read only value

Under Android 4.4.4 everything ran ok and no setting message.

Do i need to change something to run under 5.0.1?
 

SteveTerrell

Active Member
Licensed User
Ooops, found the first problem, a process global initial value was being set to a value in a different module.

Does anything need to be done about the Setting message?
 

Erel

Administrator
Staff member
Licensed User
You can use this code:
B4X:
Private Sub CheckNonMarketAppsEnabled As Boolean
   
   Dim p As Phone
   If p.SdkVersion < 17 Then
     Return p.GetSettings("install_non_market_apps") = "1"
   Else
     Dim context As JavaObject
     context.InitializeStatic("anywheresoftware.b4a.BA")
     context = context.GetField("applicationContext")
     Dim resolver As JavaObject = context.RunMethod("getContentResolver", Null)
     Dim global As JavaObject
     global.InitializeStatic("android.provider.Settings.Global")
     Return global.RunMethod("getString", Array As Object(resolver, "install_non_market_apps")) = "1"
   End If
   
End Sub
 

Mikonios

Active Member
Licensed User
I have same error.
With your fix no solve the problema
Can you help me ????
Lollipop 5.0 Note 3

B4X:
Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
 

Attachments

Mikonios

Active Member
Licensed User
You can see in the attached image, previous post.
When active sensors at runtime reports the error :::
B4X:
Setting install_non_market_apps 've Moved from android.provider.Settings.Global to android.provider.Settings.Secure , returning read-only value .
Installed the fix you indicate not solve the problem .
Only if I disable the sensors:::
B4X:
'    Dim ps1, ps2 As PhoneSensors
'    Dim sd1, sd2 As SensorData
 

victormedranop

Well-Known Member
Licensed User
I have the same problema. i cant install the apk on the pone.
said "Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value."
 
Top