Android Question Crash Report - Play Console.

Status
Not open for further replies.

fasilosman

Active Member
Licensed User
Longtime User
This is my first app I publish in play store. Can anyone help me to understand this crash report please. How to find what might be the error.

Thanks
B4X:
oday, 7:01 AM on app version 2
Nokia Nokia 6.1 (PL2_sprout), Android 9
Report 1 of 1
java.lang.RuntimeException:
  at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:158)
  at serandib.jobs.noti.handleStart (noti.java:99)
  at serandib.jobs.noti.access$000 (noti.java:8)
  at serandib.jobs.noti$2.run (noti.java:80)
  at android.os.Handler.handleCallback (Handler.java:898)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:198)
  at android.app.ActivityThread.main (ActivityThread.java:6716)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.SecurityException:
  at android.os.Parcel.createException (Parcel.java:1950)
  at android.os.Parcel.readException (Parcel.java:1918)
  at android.os.Parcel.readException (Parcel.java:1868)
  at android.app.IActivityManager$Stub$Proxy.setServiceForeground (IActivityManager.java:5150)
  at android.app.Service.startForeground (Service.java:695)
  at anywheresoftware.b4a.objects.ServiceHelper.StartForeground (ServiceHelper.java:81)
  at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:156)
Caused by: android.os.RemoteException:
  at com.android.server.am.ActivityManagerService.enforcePermission (ActivityManagerService.java:9694)
  at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked (ActiveServices.java:1234)
  at com.android.server.am.ActiveServices.setServiceForegroundLocked (ActiveServices.java:885)
  at com.android.server.am.ActivityManagerService.setServiceForeground (ActivityManagerService.java:21037)
  at android.app.IActivityManager$Stub.onTransact$setServiceForeground$ (IActivityManager.java:10577)
 

fasilosman

Active Member
Licensed User
Longtime User
Hard to say as the important information is missing. I recommend you to implement crashlytics.

I have implemented the crashlytics as follows.

I followed the instructions in this link https://www.b4x.com/android/forum/threads/crashlytics-crash-reports.87510/

01. In firebase console, I created new project and add new app using same package name but I am unable to include SHA1 because the same is added in google cloud project. download json file and put it in the b4a files folder.

02. copy and pasted relevant codes - manifest, main activity, starter service and test code.

03. opened firebase console -> and crashlytics -> then New to crashlytics then "Next"

04. After that I ran the app and test the error. But nothing happened in firebase console it shows as attached.

Can you please help me what I am missing.

Edit : - I run and tested using emulator. Is that the issue ?

hsH2zmn
 

Attachments

  • fire.png
    fire.png
    86.4 KB · Views: 238
Last edited:
Upvote 0

eps

Expert
Licensed User
Longtime User
Is there any more information in the Play Store? Sometimes it puts extra information in a slightly different place.

Or does it indicate the source of the crash? i.e. what library or module being called generated the crash?
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Is there any more information in the Play Store? Sometimes it puts extra information in a slightly different place.

Or does it indicate the source of the crash? i.e. what library or module being called generated the crash?

No other information about crash in playstore nor ANRs. Above is the detail report and now I am attaching the summary of that. Do you find anything new.
 

Attachments

  • err.png
    err.png
    7.3 KB · Views: 208
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Just now I received another crash report from same device. Do you find clue from this.
Additional information - I am running a service to check for updates for every 15 min. service name "noti". From that sub the error is generated.
Do you think it might be a permission issue.
B4X:
43 minutes ago on app version 2
Nokia Nokia 6.1 (PL2_sprout), Android 9
Report 1 of 1
java.lang.RuntimeException:
  at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3711)
  at android.app.ActivityThread.access$1600 (ActivityThread.java:200)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1694)
  at android.os.Handler.dispatchMessage (Handler.java:114)
  at android.os.Looper.loop (Looper.java:198)
  at android.app.ActivityThread.main (ActivityThread.java:6716)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.RuntimeException:
  at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:158)
  at serandib.jobs.noti.handleStart (noti.java:99)
  at serandib.jobs.noti.access$000 (noti.java:8)
  at serandib.jobs.noti$1.run (noti.java:71)
  at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand (ServiceHelper.java:221)
  at serandib.jobs.noti.onStartCommand (noti.java:69)
  at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3692)
Caused by: java.lang.SecurityException:
  at android.os.Parcel.createException (Parcel.java:1950)
  at android.os.Parcel.readException (Parcel.java:1918)
  at android.os.Parcel.readException (Parcel.java:1868)
  at android.app.IActivityManager$Stub$Proxy.setServiceForeground (IActivityManager.java:5150)
  at android.app.Service.startForeground (Service.java:695)
  at anywheresoftware.b4a.objects.ServiceHelper.StartForeground (ServiceHelper.java:81)
  at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:156)
Caused by: android.os.RemoteException:
  at com.android.server.am.ActivityManagerService.enforcePermission (ActivityManagerService.java:9694)
  at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked (ActiveServices.java:1234)
  at com.android.server.am.ActiveServices.setServiceForegroundLocked (ActiveServices.java:885)
  at com.android.server.am.ActivityManagerService.setServiceForeground (ActivityManagerService.java:21037)
  at android.app.IActivityManager$Stub.onTransact$setServiceForeground$ (IActivityManager.java:10577)
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Yes Colin. I tried in release mode but in 6in AVD-planform 24 with googleplay.
I've never tried to test Crashlytics in a simulator, so I don't know if it works or not. The Firebase doco does say that after you force a crash, you should reopen the app to allow it to report it.

I've always tested it on a real device & I have found that sometimes I have to run it a few times to get that initial crash logged.

- Colin.
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
2. What causes your service to start in the background? Make sure to use a service other than the starter service.

I have create a service called "noti" and start from an activity but not main I used
B4X:
StartService(Noti)

This is some code in service "noti"

B4X:
Sub Service_Create
    Service.AutomaticForegroundMode= Service.AUTOMATIC_FOREGROUND_WHEN_NEEDED

End Sub

Sub Service_Start (StartingIntent As Intent)
    Log("service started")
    StartServiceAt(Me, DateTime.Now + 15 * DateTime.TicksPerMinute, False)
    If StartingIntent.HasExtra("android.intent.extra.ALARM_COUNT") Then
       'Do some thin like call checking new information from the server through http job
    endif
end sub


when the job finished I call

B4X:
Service.StopAutomaticForeground
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Have you set the targetSdkVersion to 28? This is a mistake. It should be 26.

Yes. I set the targetSdkVersion to 28. Also I am using SDK version 28 and I set configure paths also to 28.
May I know Why should I set the targetSdkVersion to 26.
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
1. Read about targetSdkVersion: android.jar / targetSdkVersion / minSdkVersion

2. Recommended target for now is 26.

3. Setting it to a higher value means that you need to deal with new issues.

Hope I found the reason for the issue. It is run-time permission. I am working on it to solve.

If an app that targets Android 9 or higher attempts to create a foreground service without requesting FOREGROUND_SERVICE, the system throws a SecurityException.

https://developer.android.com/about/versions/pie/android-9.0-changes-28
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
@Erel

Is this code is correct to add manifest for my above reply (SDK 28 permission)
B4X:
AddManifestText(
<uses-permission
  android:name="android.permission.FOREGROUND_SERVICE"
  android:maxSdkVersion="28" />
)

or can directly add to manifest as this
B4X:
AddPermission(android.permission.FOREGROUND_SERVICE)

Edit : I am sorry. I couldn't find "FOREGROUND_SERVICE" in runtime permission library. I think I should wait until the runtime permission library is updated. My current version is 1.10
 
Last edited:
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
You should open the manifest editor. Look for targetSdkVersion and set it to 26.
Yes. Thanks. I have already set it to 26 and published in google play.

01. Does it effect any users who already installed on devices Android 9.0 and 8.1. and how will be the effect.
02. Can the uses install the app who have higher than the SDK version 26 install.
03. Do I have to wait until the new B4A release which support the SDK version 28 to apply changes of the same.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
B4A v8.50 supports Android 9. Don't confuse "support" with recommended targetSdkVersion.

Thank you. I have created an AVD with sdk 28 and tested working fine.
I have understood except one. and Sorry to bother you again and again.

If B4A 8.5 supports android 9 (SDK 28) then why I couldn't find "android.permission.FOREGROUND_SERVICE" in runtime library. Do am I missing something.
 
Upvote 0
Status
Not open for further replies.
Top