Android Question widget problem with lollipop

fotosettore

Member
Licensed User
Longtime User
hi all
i noted that widgets are not loaded after my phone (Honor7 - android 5.02) was upgraded to rom version b188
with previous rom, all worked fine.
now, if i load my app, this error appears:

B4X:
** Service (widgetsched) Create **
Error occurred on line: 16 (WidgetSched)
java.io.FileNotFoundException: binuntius200_widget_sched.bal
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:313)
at android.content.res.AssetManager.open(AssetManager.java:287)
at anywheresoftware.b4a.objects.RemoteViewsWrapper.createRemoteViews(RemoteViewsWrapper.java:39)
at BiNuntius.II.widgetsched._service_create(widgetsched.java:167)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at BiNuntius.II.widgetsched.onCreate(widgetsched.java:53)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2858)
at android.app.ActivityThread.access$2200(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5539)
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:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
** Service (widgetsched) Start **

please note that "binuntius200_widget_sched.bal" exists : it is in "files" directory as it has always been and code was not changed.
same situation happens with another widget loaded later in app

it seems that is not possible to have access in desktop phone window
does this new scenario need to add some new permission ?

regards
peppe
 
Last edited:

fotosettore

Member
Licensed User
Longtime User
hi erel
i tried in degub e release mode. there are two strange situations:
RELEASE : the app gives error i posted only if on desktop of smartphone is already present the widget. if i delete widget, the app is able to compile. after compilation i put again the widget and all works fine.
DEBUG : the app gives error i posted when i try to compile, with no way out. even if i delete widget, the compilation gives always error .
please note that before upgrade the code never gave error, both in debug and in release, with or without widget on desktop.

regards
peppe
 
Upvote 0

fotosettore

Member
Licensed User
Longtime User
hi erel
this is the error log in RELEASE mode and widget on the desktop of smartphone

B4X:
java.lang.RuntimeException: Unable to create service BiNuntius.II.widget4146: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2878)
    at android.app.ActivityThread.access$2200(ActivityThread.java:152)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5539)
    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:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at BiNuntius.II.widget4146.onCreate(widget4146.java:37)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2858)
    ... 9 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at BiNuntius.II.widget4146.onCreate(widget4146.java:35)
    ... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to read from field 'BiNuntius.II.routines BiNuntius.II.starter._routines' on a null object reference
    at BiNuntius.II.main.initializeProcessGlobals(main.java:8112)
    ... 13 more
Caused by: java.lang.NullPointerException: Attempt to read from field 'BiNuntius.II.routines BiNuntius.II.starter._routines' on a null object reference
    at BiNuntius.II.starter._process_globals(starter.java:186)
    at BiNuntius.II.main.initializeProcessGlobals(main.java:8108)
    ... 13 more
java.lang.RuntimeException: Unable to create service BiNuntius.II.widget4146: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2878)
    at android.app.ActivityThread.access$2200(ActivityThread.java:152)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5539)
    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:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at BiNuntius.II.widget4146.onCreate(widget4146.java:37)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2858)
    ... 9 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at BiNuntius.II.widget4146.onCreate(widget4146.java:35)
    ... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to read from field 'BiNuntius.II.routines BiNuntius.II.starter._routines' on a null object reference
    at BiNuntius.II.main.initializeProcessGlobals(main.java:8112)
    ... 13 more
Caused by: java.lang.NullPointerException: Attempt to read from field 'BiNuntius.II.routines BiNuntius.II.starter._routines' on a null object reference
    at BiNuntius.II.starter._process_globals(starter.java:186)
    at BiNuntius.II.main.initializeProcessGlobals(main.java:8108)
    ... 13 more

if i put widget in the trash can before compiling, no error appears and compiling ends without errors

regards
peppe
 
Upvote 0

fotosettore

Member
Licensed User
Longtime User
hi erel
here is the code in Starter service
B4X:
Sub Process_Globals
    Private logs As StringBuilder
    Private logcat As LogCat
    Private const emailAddress As String = "info@homoandroidus.com"
    Private const FileLogDaInviare As String = Routines.CartellaConf & "/" & Routines.FileLog
End Sub

and from "Sub Process_Globals" of Routines code module ....
B4X:
Dim CartellaConf As String = File.DirRootExternal & "/Ringtones/bnii_conf"
Dim FileLog As String = "BiNuntius_Log.txt"

regards
peppe
 
Upvote 0

fotosettore

Member
Licensed User
Longtime User
sorry erel
what code are you talking about?

if i put the above code of process_global sub of Starter service in Service_Create, b4a goes in error

and
rv = ConfigureHomeWidget("binuntius200_widget_sched", "rv", 60, "BN sched widget")

is already in Service_Create of WidgetSched service

please help me to understand

regards
peppe
 
Upvote 0

fotosettore

Member
Licensed User
Longtime User
This line is wrong:
B4X:
Private const FileLogDaInviare As String = Routines.CartellaConf & "/" & Routines.FileLog
i put this line in sub Application_Error of Starter service.
no more errors
thanks erel
regards
peppe
 
Last edited:
Upvote 0
Top