Android Question BLE2 Example Error

Diego Marcelo Croatto

Member
Licensed User
Hi to all....
1º I load the ble_example-zip
2º Then Run it in Debug mode with this manifest:
Manifest:
'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: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
AddPermission(android.permission.ACCESS_FINE_LOCATION)

3º Run it.... an when i press the "SCAN & CONNECT" button the program crash

Crash Error:
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
    at anywheresoftware.b4a.objects.RuntimePermissions.Check(RuntimePermissions.java:73)
    at anywheresoftware.b4a.objects.RuntimePermissions.CheckAndRequest(RuntimePermissions.java:97)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:5204)
    at android.view.View$PerformClick.run(View.java:21170)
    at android.os.Handler.handleCallback(Handler.java:743)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5418)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.ContextCompat" on path: DexPathList[[zip file "/data/app/b4a.bbb-1/base.apk"],nativeLibraryDirectories=[/data/app/b4a.bbb-1/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 20 more

What is the problem! .... in the device the systen never ask the permission.

Thank's a lot
 
Hi
I used the same example and I am able to read data. However I am able to read only Android TV data. I have a smart band (Mi Band 5) which is near my phone but the BLE example is not able to detect it. I used nrf connect app and LightBlue app. Both of these apps detect the smart band under 'bonded' tag. The Android TV is detected under 'Scanner' tab of the apps. Is there a way to detect 'bonded' devices with BLE example?
 
Upvote 0

bocker77

Active Member
Licensed User
Seeing that I am getting this error, do I need to uninstall any of the required additional products for the most current release of B4X and install most current?

B4a v10.2 11/12/2020

Here is what I have installed on my PC.
Android SDK Tools 1.16 updated 8/12/2020
Java 8 Update 251 (64-bit) 4/15/2020
Java SE Development Kit 8 Update 121 (64-bit) 3/15/2017
 
Upvote 0

DonManfred

Expert
Licensed User
B4a v10.2 11/12/2020

Here is what I have installed on my PC.
Android SDK Tools 1.16 updated 8/12/2020
Java 8 Update 251 (64-bit) 4/15/2020
Java SE Development Kit 8 Update 121 (64-bit) 3/15/2017
Find the Installinstructions here. Follow it carefully

 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Seeing that I am getting this error,....
if you have the same error do the same solution, check the path :)

better if you create a new question with your error, I don't think the solution is reinstall b4x all the time to solve errores if that worked before.
 
Upvote 0
Top