Android Question [Things] B4A Class - BeaconParser

Hypnos

Active Member
Licensed User
Longtime User
Hi All,

I want to use a raspberry pi 3 to monitor my beacons instead of an android phone so I use this B4A Class on Android Things Platform but got the following error:

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
starter_scan (java line: 208)
java.lang.RuntimeException: Error starting scan.
    at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:142)
    at b4a.example.starter._scan(starter.java:208)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1044)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:978)
    at b4a.example.main._btnscan_click(main.java:373)
    at b4a.example.main._activity_create(main.java:343)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at b4a.example.main.afterFirstLayout(main.java:102)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Anyone have idea? is that because Android things not yet support BLE yet? Thanks!
 

Hypnos

Active Member
Licensed User
Longtime User
Check the unfiltered logs. There might be more information.

Are you using the latest version (4.1) ?
https://developer.android.com/things/preview/download.html

Yes, I'm using the latest version. here is the unfiltered log (full log can be found on the attachment)

B4X:
*** Service (starter) Create ***
Message: 20
Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy@6a752ca:true
** Service (starter) Start **
Skipped 64 frames!  The application may be doing too much work on its main thread.
Long monitor contention with owner android.display (432) at void com.android.server.wm.WindowAnimator$1.doFrame(long)(WindowAnimator.java:138) waiters=0 in int com.android.server.wm.WindowManagerService.relayoutWindow(com.android.server.wm.Session, android.view.IWindow, int, android.view.WindowManager$LayoutParams, int, int, int, int, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.content.res.Configuration, android.view.Surface) for 360ms
ignoring event: statechanged
** Activity (main) Create, isFirst = true **
startLeScan(): null
startLeScan: cannot get BluetoothLeScanner
starter_scan (java line: 208)
java.lang.RuntimeException: Error starting scan.
    at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:142)
    at b4a.example.starter._scan(starter.java:208)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1044)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:978)
    at b4a.example.main._btnscan_click(main.java:373)
    at b4a.example.main._activity_create(main.java:343)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at b4a.example.main.afterFirstLayout(main.java:102)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
--------- beginning of crash
FATAL EXCEPTION: main
Process: b4a.example, PID: 1349
java.lang.RuntimeException: Error starting scan.
    at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:142)
    at b4a.example.starter._scan(starter.java:208)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1044)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:978)
    at b4a.example.main._btnscan_click(main.java:373)
    at b4a.example.main._activity_create(main.java:343)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at b4a.example.main.afterFirstLayout(main.java:102)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
  Force finishing activity b4a.example/.main
Sending signal. PID: 1349 SIG: 9
Error writing /proc/1349/oom_score_adj; errno=22
channel '86e586c b4a.example/b4a.example.main (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
channel '86e586c b4a.example/b4a.example.main (server)' ~ Channel is unrecoverably broken and will be disposed!
WIN DEATH: Window{86e586c u0 b4a.example/b4a.example.main}
Attempted to unregister already unregistered input channel '86e586c b4a.example/b4a.example.main (server)'
Destroying surface Surface(name=b4a.example/b4a.example.main) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowState$DeathRecipient.binderDied:1780 android.os.BinderProxy.sendDeathNotice:688 <bottom of call stack>
Process b4a.example (pid 1349) has died
cleanUpApplicationRecord -- 1349
Scheduling restart of crashed service b4a.example/.starter in 1000ms
Destroying surface Surface(name=Starting b4a.example) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@2f7b7b3 attribute=null, token = android.os.BinderProxy@c229d6b
Compilation of void v.a(i, int, int, int, boolean) took 164.440ms
dex2oat took 2.273s (threads: 4) arena alloc=2MB (3141728B) java alloc=563KB (577176B) native alloc=1934KB (1980960B) free=4MB (4834784B)
Unknown instruction set features for ARM CPU variant (generic) using conservative defaults
/system/bin/dex2oat --dex-file=/data/user_de/0/com.google.android.gms/app_chimera/m/00000000/GoogleCertificates_GmsCore_things_alldpi_release.apk --oat-fd=37 --oat-location=/data/user_de/0/com.google.android.gms/app_chimera/m/00000000/oat/arm/GoogleCertificates_GmsCore_things_alldpi_release.dex --compiler-filter=speed
Error opening trace file: No such file or directory (2)
dex2oat took 579.136ms (threads: 4) arena alloc=635KB (651072B) java alloc=541KB (554136B) native alloc=1381KB (1414416B) free=3MB (3304176B)
File error accessing recents directory (directory doesn't exist?).
ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCoreThings/lib/arm
ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCoreThings/lib/arm
 

Attachments

  • ble.zip
    26.9 KB · Views: 381
Upvote 0

Hypnos

Active Member
Licensed User
Longtime User
Upvote 0
Top