Android Question BLE2 error

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi,

On my iTag Alarm App I get quite a lot of errors recorded in the Google Developper console.

Here is the log :
B4X:
java.lang.NoClassDefFoundError: anywheresoftware.b4a.objects.BleManager2$2
    at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:112)
    at fr.free.julienGley.iTagAlarm.ble_scan._scan(ble_scan.java:861)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5293)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
    at dalvik.system.NativeStart.main(Native Method)

It seems that there is a problem when invoking BLEManager2.Scan2

Looking at the devices and android versions it is always with API 4.2 or below

Android 4.2
Android 4.1
Android 2.3.3
Android 4.0.3

It's for sure because these old devices do not support BLE.

How would it be possible to filter "old Androids" in the Manifest ?

I have already these lines :

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

Thank you for any advice
 

freedom2000

Well-Known Member
Licensed User
Longtime User
After googling a little I found this :

Android 4.3 (API Level 18) introduces built-in platform support for Bluetooth Low Energy

So I have changed the Manifest with this line :

<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>

I hope that it will prevent the issue !
 
Upvote 0
Top