b3b/able

Didn't find class "org.able.BLE"

Opened this issue · 4 comments

sooko commented

i came across this problem to day while trying to build to start my new project

Traceback (most recent call last):
07-15 03:04:18.792 5657 5696 I python : File "/home/sooko/prj/git/able/examples/alert/.buildozer/android/app/main.py", line 6, in
07-15 03:04:18.792 5657 5696 I python : File "/home/sooko/prj/git/able/examples/alert/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/ble/arm64-v8a/able/init.py", line 30, in
07-15 03:04:18.792 5657 5696 I python : File "/home/sooko/prj/git/able/examples/alert/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/ble/arm64-v8a/able/android/dispatcher.py", line 14, in
07-15 03:04:18.792 5657 5696 I python : File "/home/sooko/prj/git/able/examples/alert/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/ble/arm64-v8a/jnius/reflect.py", line 209, in autoclass
07-15 03:04:18.792 5657 5696 I python : File "jnius/jnius_export_func.pxi", line 22, in jnius.jnius.find_javaclass
07-15 03:04:18.792 5657 5696 I python : File "jnius/jnius_utils.pxi", line 79, in jnius.jnius.check_exception
07-15 03:04:18.792 5657 5696 I python : jnius.jnius.JavaException: JVM exception occurred: Didn't find class "org.able.BLE" on path: DexPathList[[zip file "/data/app/~~jl-LfZi21GTWADs9WNsRiw==/io.sooko.ble-Yc3olsilIiK7s8JWfe1Q-A==/base.apk"],nativeLibraryDirectories=[/data/app/~~jl-LfZi21GTWADs9WNsRiw==/io.sooko.ble-Yc3olsilIiK7s8JWfe1Q-A==/lib/arm64, /data/app/~~jl-LfZi21GTWADs9WNsRiw==/io.sooko.ble-Yc3olsilIiK7s8JWfe1Q-A==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] java.lang.ClassNotFoundException
07-15 03:04:18.792 5657 5696 I python : Python for android ended.

b3b commented

Hi @sooko ,
It seems BLE wasn't included in the build.
Maybe there were some error messages during the buildozer build?
You can try the possible solution of removing the .buildozer directory and then performing a build from a clean page. Hope this helps.

I get the same error on a clean build of the alert example. I don't see any error messages in the buildozer log. The installer log indicates at least some files of amble are being installed:

04-21 11:08:52.706 11357 11390 V python  : extracting _python_bundle/site-packages/able/
04-21 11:08:52.707 11357 11390 V python  : extracting _python_bundle/site-packages/able/__init__.pyc
...

Which file should be present to provide org.able.BLE?

b3b commented

Hi @woutersj,

BLE.class file should be produced and included in the build. However, this file won't be mentioned in the Android logs.

A successful build can be identified by messages in the buildozer log:

Distribution name found: 'alert_mi'.
...
Java classes directory found: '/.../javaclasses/alert_mi'.
...
Building wheel for able_recipe (pyproject.toml) ... done

It seems this issue arises during the installation process when pip using a cached able_recipe wheel,
leading to the exclusion of Java files from the build.
A new version (able_recipe==1.0.15) should resolve this by renaming the resulting wheel to bypass caching.

Additionally, new Android log messages have been introduced to indicate

  • success: org.able.BLE Java class loaded ,
  • and errors: Failed to load Java class org.able.BLE. Possible build error .