chrisriesgo / Android-AltBeacon-Library

Proximity beacon ranging and monitoring library for Xamarin.Android apps
Apache License 2.0
41 stars 44 forks source link

Some 8.1 devices throwing exceptions on ScanJob (2.15 version of lib) #43

Open rossvernal opened 5 years ago

rossvernal commented 5 years ago

I'm seeing my app crashing quite regularly with a single device - a Moto G, running Android 8.1. It's using the @luposlip library version - 2.15

I get this error:

executing service com.glmobileapp/org.altbeacon.beacon.service.ScanJob, InvisibleToUser
org.altbeacon.beacon.service.ScanJob

Almost all other devices are fine, but it does this so regularly on one device that Google are pulling my app off the store.

Has anyone else come across this?

This is the stack trace:

`"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 flags=1 obj=0x729279f0 self=0xabbb5000 | sysTid=4883 nice=0 cgrp=default sched=0/0 handle=0xafd334a4 | state=D schedstat=( 1926726438 51800625 338 ) utm=140 stm=51 core=6 HZ=100 | stack=0xbe259000-0xbe25b000 stackSize=8MB | held mutexes=

00 pc 0000000000048cd4 /system/lib/libc.so (__openat+12)

01 pc 000000000001f3a3 /system/lib/libc.so (open+54)

02 pc 00000000000151cb /system/lib/libopenjdk.so (handleOpen+26)

03 pc 0000000000015285 /system/lib/libopenjdk.so (fileOpen+68)

04 pc 00000000000149f5 /system/lib/libopenjdk.so (FileOutputStream_open0+28)

05 pc 000000000002a989 /system/framework/arm/boot-core-oj.oat (Java_java_io_FileOutputStream_open0__Ljava_lang_String_2Z+96)

at java.io.FileOutputStream.open0 (Native method)

at java.io.FileOutputStream.open (FileOutputStream.java:287)

at java.io.FileOutputStream. (FileOutputStream.java:223)

at android.app.ContextImpl.openFileOutput (ContextImpl.java:539)

at android.content.ContextWrapper.openFileOutput (ContextWrapper.java:201)

at org.altbeacon.beacon.service.ScanState.save (ScanState.java:193) locked <0x03137a6d> (a java.lang.Class)

at org.altbeacon.beacon.service.ScanState.applyChanges (ScanState.java:291)

at org.altbeacon.beacon.service.ScanJobScheduler.applySettingsToScheduledJob (ScanJobScheduler.java:83)

at org.altbeacon.beacon.service.ScanJobScheduler.applySettingsToScheduledJob (ScanJobScheduler.java:92)

at org.altbeacon.beacon.BeaconManager.applyChangesToServices (BeaconManager.java:983)

at org.altbeacon.beacon.BeaconManager.startMonitoringBeaconsInRegion (BeaconManager.java:923)

at org.altbeacon.beacon.startup.RegionBootstrap$InternalBeaconConsumer.onBeaconServiceConnect (RegionBootstrap.java:155)

at org.altbeacon.beacon.BeaconManager.bind (BeaconManager.java:428) locked <0x01dbe756> (a java.util.concurrent.ConcurrentHashMap)

at org.altbeacon.beacon.startup.RegionBootstrap. (RegionBootstrap.java:77)

at md5c497ac42f3138c67aed930c79af470d4.MainApplication.n_onCreate (Native method)

at md5c497ac42f3138c67aed930c79af470d4.MainApplication.onCreate (MainApplication.java:40)

at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1141)

at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5854)

at android.app.ActivityThread.-wrap1 (ActivityThread.java)

at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1697)

at android.os.Handler.dispatchMessage (Handler.java:106)

at android.os.Looper.loop (Looper.java:164)

at android.app.ActivityThread.main (ActivityThread.java:6626)

at java.lang.reflect.Method.invoke (Native method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:811)`

rossvernal commented 5 years ago

Having looked at ScanState.save, it looks like it's failing on this line:

outputStream = mContext.openFileOutput(TEMP_STATUS_PRESERVATION_FILE_NAME, MODE_PRIVATE);

I think it can't write to a file for some reason, the file is here: https://github.com/luposlip/android-beacon-library/blob/master/src/main/java/org/altbeacon/beacon/service/ScanState.java