question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kivy bleak example, didn't find PythonScanCallback

See original GitHub issue
  • bleak version: 0.14.2
  • Python version: 3.8.10
  • Operating System: ubuntu 20.04 LTS
  • BlueZ version (bluetoothctl -v) in case of Linux: 5.53

Description

I’m trying to run the Kivy example on an android phone and final apk fails to launch with the error: “Didn’t find class com.github.hbldh.bleak.PythonScanCallback”. “buildozer android debug” completed successfully without errors.

What I Did

I created a VM with ubuntu 20.04 LTS, made a virtual environment with the following packages:

appdirs==1.4.4
bleak==0.14.2
buildozer==1.2.0
colorama==0.4.4
Cython==0.29.27
dbus-next==0.2.3
distlib==0.3.4
filelock==3.4.2
importlib-metadata==4.10.1
Jinja2==3.0.3
MarkupSafe==2.0.1
pep517==0.6.0
pexpect==4.8.0
pkg_resources==0.0.0
platformdirs==2.4.1
ptyprocess==0.7.0
pytoml==0.1.21
sh==1.14.2
six==1.16.0
toml==0.10.2
virtualenv==20.13.0
zipp==3.7.0

I ran “buildozer android debug” using the included buildozer.spec file (no edits from GIT revision) and the command completed without any errors. Attached is the logcat from running the application on my phone.

# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.7 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/user/sirens/venv-sirens/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-13-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-13-openjdk-amd64/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /home/user/sirens/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /home/user/sirens/.buildozer/android/platform/python-for-android
* develop 8b173d99 [origin/develop] Update recipe.py (#2544) (#2546)
# Run '/home/user/sirens/venv-sirens/bin/python -m pip install -q  \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0\' \'toml\''
# Cwd None
# Apache ANT found at /home/user/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/user/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 19c
# Android NDK found at /home/user/.buildozer/android/platform/android-ndk-r19c
# Read available permissions from api-versions.xml
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/home/user/sirens/venv-sirens/bin/python -m pythonforandroid.toolchain create --dist_name=bleakdemo --bootstrap=sdl2 --requirements=python3,kivy,bleak,async_to_sync --arch armeabi-v7a --copy-libs --local-recipes /home/bleak/backends/p4android/recipes --color=always --storage-dir="/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21'
# Cwd /home/user/sirens/.buildozer/android/platform/python-for-android
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 27
[INFO]:    Available Android APIs are (27)
[INFO]:    Requested API target 27 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/user/.buildozer/android/platform/android-ndk-r19c
[INFO]:    Found NDK version 19c
[INFO]:    Getting NDK API version (i.e. minimum supported API) from user argument
[INFO]:    ccache is missing, the build will not be optimized in the future.
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:    	bleakdemo: min API 21, includes recipes (hostpython3, libffi, openssl, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3, sdl2, setuptools, six, pyjnius, android, kivy, certifi, async_to_sync, bleak), built for archs (armeabi-v7a)
[INFO]:    bleakdemo has compatible recipes, using this one
# Run '/home/user/.buildozer/android/platform/android-sdk/platform-tools/adb devices'
# Cwd None
List of devices attached
3057574931593098	device

# Deploy on 3057574931593098
# Run '/home/user/.buildozer/android/platform/android-sdk/platform-tools/adb install -r "/home/user/sirens/bin/bleakdemo-0.1.0-armeabi-v7a-debug.apk"'
# Cwd /home/user/.buildozer/android/platform
Performing Streamed Install
Success
# Application pushed.
# Run on 3057574931593098
# Run '/home/user/.buildozer/android/platform/android-sdk/platform-tools/adb shell am start -n com.github.hbldh.bleakdemo/org.kivy.android.PythonActivity -a org.kivy.android.PythonActivity'
# Cwd /home/user/.buildozer/android/platform
Starting: Intent { act=org.kivy.android.PythonActivity cmp=com.github.hbldh.bleakdemo/org.kivy.android.PythonActivity }
# Application started.
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.7 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/user/sirens/venv-sirens/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-13-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-13-openjdk-amd64/bin/keytool
# Run '/home/user/.buildozer/android/platform/android-sdk/platform-tools/adb logcat *:S python:D'
# Cwd /home/user/.buildozer/android/platform
--------- beginning of crash
--------- beginning of main
--------- beginning of system
02-04 09:13:26.211 16135 23616 I python  : Initializing Python for Android
02-04 09:13:26.211 16135 23616 I python  : Setting additional env vars from p4a_env_vars.txt
02-04 09:13:26.211 16135 23616 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
02-04 09:13:26.211 16135 23616 I python  : /data/user/0/com.github.hbldh.bleakdemo/files/app
02-04 09:13:26.211 16135 23616 I python  : Preparing to initialize python
02-04 09:13:26.211 16135 23616 I python  : _python_bundle dir exists
02-04 09:13:26.211 16135 23616 I python  : calculated paths to be...
02-04 09:13:26.211 16135 23616 I python  : /data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/stdlib.zip:/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/modules
02-04 09:13:26.214 16135 23616 I python  : set wchar paths...
02-04 09:13:26.254 16135 23616 I python  : Initialized python
02-04 09:13:26.254 16135 23616 I python  : AND: Init threads
02-04 09:13:26.255 16135 23616 I python  : testing python print redirection
02-04 09:13:26.255 16135 23616 I python  : Android path ['.', '/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/stdlib.zip', '/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/modules', '/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/site-packages']
02-04 09:13:26.256 16135 23616 I python  : os.environ is environ({'PATH': '/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin', 'MOUNT_SYSTEM_OK': 'true', 'ANDROID_BOOTLOGO': '1', 'ANDROID_ROOT': '/system', 'ANDROID_ASSETS': '/system/app', 'ANDROID_DATA': '/data', 'ANDROID_STORAGE': '/storage', 'ANDROID_RUNTIME_ROOT': '/apex/com.android.runtime', 'ANDROID_TZDATA_ROOT': '/apex/com.android.tzdata', 'EXTERNAL_STORAGE': '/sdcard', 'ASEC_MOUNTPOINT': '/mnt/asec', 'BOOTCLASSPATH': '/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/knoxsdk.jar:/system/framework/knoxanalyticssdk.jar:/system/framework/smartbondingservice.jar:/system/framework/securetimersdk.jar:/system/framework/fipstimakeystore.jar:/system/framework/timakeystore.jar:/system/framework/sec_sdp_sdk.jar:/system/framework/sec_sdp_hidden_sdk.jar:/system/framework/drutils.jar:/system/framework/android.test.base.jar:/system/framework/ucmopensslenginehelper.jar:/system/framework/esecomm.jar:/system/framework/tcmiface.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar', 'DEX2OATBOOTCLASSPATH': '/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/knoxsdk.jar:/system/framework/knoxanalyticssdk.jar:/system/framework/smartbondingservice.jar:/system/framework/securetimersdk.jar:/system/framework/fipstimakeystore.jar:/system/framework/timakeystore.jar:/system/framework/sec_sdp_sdk.jar:/system/framework/sec_sdp_hidden_sdk.jar:/system/framework/drutils.jar:/system/framework/android.test.base.jar:/system/framework/ucmopensslenginehelper.jar:/system/framework/esecomm.jar:/system/framework/tcmiface.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar:/system/framework/uibc_java.jar:/system/framework/ssrm.jar', 'DOWNLOAD_CACHE': '/data/cache', 'MC_AUTH_TOKEN_PATH': '/efs/TEE', 'KNOX_STORAGE': '/data/knox/ext_sdcard', 'ENC_EMULATED_STORAGE_TARGET': '/storage/enc_emulated', 'ANDROID_SOCKET_zygote_secondary': '21', 'ANDROID_SOCKET_usap_pool_secondary': '22', 'ANDROID_ENTRYPOINT': 'main.pyc', 'ANDROID_ARGUMENT': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'ANDROID_APP_PATH': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'ANDROID_PRIVATE': '/data/user/0/com.github.hbldh.bleakdemo/files', 'ANDROID_UNPACK': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'PYTHONHOME': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'PYTHONPATH': '/data/user/0/com.github.hbldh.bleakdemo/files/app:/data/user/0/com.github.hbldh.bleakdemo/files/app/lib', 'PYTHONOPTIMIZE': '2', 'P4A_BOOTSTRAP': 'SDL2', 'PYTHON_NAME': 'python', 'P4A_IS_WINDOWED': 'True', 'P4A_ORIENTATION': 'portrait', 'P4A_NUMERIC_VERSION': 'None', 'P4A_MINSDK': '21', 'LC_CTYPE': 'C.UTF-8'})
02-04 09:13:26.256 16135 23616 I python  : Android kivy bootstrap done. __name__ is __main__
02-04 09:13:26.256 16135 23616 I python  : AND: Ran string
02-04 09:13:26.256 16135 23616 I python  : Run user program, change dir and execute entrypoint
02-04 09:13:26.349 16135 23616 I python  : [WARNING] [Config      ] Older configuration version detected (0 instead of 21)
02-04 09:13:26.350 16135 23616 I python  : [WARNING] [Config      ] Upgrading configuration in progress.
02-04 09:13:26.355 16135 23616 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/com.github.hbldh.bleakdemo/files/app/.kivy/logs/kivy_22-02-04_0.txt
02-04 09:13:26.355 16135 23616 I python  : [INFO   ] [Kivy        ] v2.0.0
02-04 09:13:26.355 16135 23616 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
02-04 09:13:26.355 16135 23616 I python  : [INFO   ] [Python      ] v3.8.9 (default, Feb  4 2022, 09:07:38) 
02-04 09:13:26.355 16135 23616 I python  : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
02-04 09:13:26.355 16135 23616 I python  : [INFO   ] [Python      ] Interpreter at ""
02-04 09:13:27.276 16135 23616 I python  : [INFO   ] [Factory     ] 186 symbols loaded
02-04 09:13:27.471 16135 23616 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
02-04 09:13:27.495 16135 23616 I python  : [INFO   ] [Text        ] Provider: sdl2
02-04 09:13:28.263 16135 23616 I python  :  Traceback (most recent call last):
02-04 09:13:28.263 16135 23616 I python  :    File "/home/user/sirens/.buildozer/android/app/main.py", line 14, in <module>
02-04 09:13:28.264 16135 23616 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/bleak/__init__.py", line 34, in <module>
02-04 09:13:28.265 16135 23616 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/bleak/backends/p4android/scanner.py", line 16, in <module>
02-04 09:13:28.265 16135 23616 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/bleak/backends/p4android/defs.py", line 28, in <module>
02-04 09:13:28.272 16135 23616 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/jnius/reflect.py", line 229, in autoclass
02-04 09:13:28.272 16135 23616 I python  :    File "jnius/jnius_export_func.pxi", line 26, in jnius.jnius.find_javaclass
02-04 09:13:28.273 16135 23616 I python  :    File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception
02-04 09:13:28.273 16135 23616 I python  :  jnius.jnius.JavaException: JVM exception occurred: Didn't find class "com.github.hbldh.bleak.PythonScanCallback" on path: DexPathList[[zip file "/data/app/com.github.hbldh.bleakdemo-2S_nGQ7XxNtDTHeUqZZSpQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.github.hbldh.bleakdemo-2S_nGQ7XxNtDTHeUqZZSpQ==/lib/arm, /data/app/com.github.hbldh.bleakdemo-2S_nGQ7XxNtDTHeUqZZSpQ==/base.apk!/lib/armeabi-v7a, /system/lib, /system/product/lib]] java.lang.ClassNotFoundException
02-04 09:13:28.273 16135 23616 I python  : Python for android ended.
02-04 09:14:19.511 16983 24570 I python  : Initializing Python for Android
02-04 09:14:19.511 16983 24570 I python  : Setting additional env vars from p4a_env_vars.txt
02-04 09:14:19.512 16983 24570 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
02-04 09:14:19.512 16983 24570 I python  : /data/user/0/com.github.hbldh.bleakdemo/files/app
02-04 09:14:19.512 16983 24570 I python  : Preparing to initialize python
02-04 09:14:19.512 16983 24570 I python  : _python_bundle dir exists
02-04 09:14:19.512 16983 24570 I python  : calculated paths to be...
02-04 09:14:19.512 16983 24570 I python  : /data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/stdlib.zip:/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/modules
02-04 09:14:19.515 16983 24570 I python  : set wchar paths...
02-04 09:14:19.555 16983 24570 I python  : Initialized python
02-04 09:14:19.555 16983 24570 I python  : AND: Init threads
02-04 09:14:19.556 16983 24570 I python  : testing python print redirection
02-04 09:14:19.556 16983 24570 I python  : Android path ['.', '/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/stdlib.zip', '/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/modules', '/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/site-packages']
02-04 09:14:19.557 16983 24570 I python  : os.environ is environ({'PATH': '/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin', 'MOUNT_SYSTEM_OK': 'true', 'ANDROID_BOOTLOGO': '1', 'ANDROID_ROOT': '/system', 'ANDROID_ASSETS': '/system/app', 'ANDROID_DATA': '/data', 'ANDROID_STORAGE': '/storage', 'ANDROID_RUNTIME_ROOT': '/apex/com.android.runtime', 'ANDROID_TZDATA_ROOT': '/apex/com.android.tzdata', 'EXTERNAL_STORAGE': '/sdcard', 'ASEC_MOUNTPOINT': '/mnt/asec', 'BOOTCLASSPATH': '/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/knoxsdk.jar:/system/framework/knoxanalyticssdk.jar:/system/framework/smartbondingservice.jar:/system/framework/securetimersdk.jar:/system/framework/fipstimakeystore.jar:/system/framework/timakeystore.jar:/system/framework/sec_sdp_sdk.jar:/system/framework/sec_sdp_hidden_sdk.jar:/system/framework/drutils.jar:/system/framework/android.test.base.jar:/system/framework/ucmopensslenginehelper.jar:/system/framework/esecomm.jar:/system/framework/tcmiface.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar', 'DEX2OATBOOTCLASSPATH': '/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/knoxsdk.jar:/system/framework/knoxanalyticssdk.jar:/system/framework/smartbondingservice.jar:/system/framework/securetimersdk.jar:/system/framework/fipstimakeystore.jar:/system/framework/timakeystore.jar:/system/framework/sec_sdp_sdk.jar:/system/framework/sec_sdp_hidden_sdk.jar:/system/framework/drutils.jar:/system/framework/android.test.base.jar:/system/framework/ucmopensslenginehelper.jar:/system/framework/esecomm.jar:/system/framework/tcmiface.jar:/system/framework/QPerformance.jar:/system/framework/UxPerformance.jar', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar:/system/framework/uibc_java.jar:/system/framework/ssrm.jar', 'DOWNLOAD_CACHE': '/data/cache', 'MC_AUTH_TOKEN_PATH': '/efs/TEE', 'KNOX_STORAGE': '/data/knox/ext_sdcard', 'ENC_EMULATED_STORAGE_TARGET': '/storage/enc_emulated', 'ANDROID_SOCKET_zygote_secondary': '21', 'ANDROID_SOCKET_usap_pool_secondary': '22', 'ANDROID_ENTRYPOINT': 'main.pyc', 'ANDROID_ARGUMENT': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'ANDROID_APP_PATH': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'ANDROID_PRIVATE': '/data/user/0/com.github.hbldh.bleakdemo/files', 'ANDROID_UNPACK': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'PYTHONHOME': '/data/user/0/com.github.hbldh.bleakdemo/files/app', 'PYTHONPATH': '/data/user/0/com.github.hbldh.bleakdemo/files/app:/data/user/0/com.github.hbldh.bleakdemo/files/app/lib', 'PYTHONOPTIMIZE': '2', 'P4A_BOOTSTRAP': 'SDL2', 'PYTHON_NAME': 'python', 'P4A_IS_WINDOWED': 'True', 'P4A_ORIENTATION': 'portrait', 'P4A_NUMERIC_VERSION': 'None', 'P4A_MINSDK': '21', 'LC_CTYPE': 'C.UTF-8'})
02-04 09:14:19.557 16983 24570 I python  : Android kivy bootstrap done. __name__ is __main__
02-04 09:14:19.557 16983 24570 I python  : AND: Ran string
02-04 09:14:19.557 16983 24570 I python  : Run user program, change dir and execute entrypoint
02-04 09:14:19.643 16983 24570 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/com.github.hbldh.bleakdemo/files/app/.kivy/logs/kivy_22-02-04_1.txt
02-04 09:14:19.644 16983 24570 I python  : [INFO   ] [Kivy        ] v2.0.0
02-04 09:14:19.644 16983 24570 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/com.github.hbldh.bleakdemo/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
02-04 09:14:19.644 16983 24570 I python  : [INFO   ] [Python      ] v3.8.9 (default, Feb  4 2022, 09:07:38) 
02-04 09:14:19.644 16983 24570 I python  : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
02-04 09:14:19.644 16983 24570 I python  : [INFO   ] [Python      ] Interpreter at ""
02-04 09:14:20.539 16983 24570 I python  : [INFO   ] [Factory     ] 186 symbols loaded
02-04 09:14:20.737 16983 24570 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
02-04 09:14:20.760 16983 24570 I python  : [INFO   ] [Text        ] Provider: sdl2
02-04 09:14:21.215 16983 24570 I python  :  Traceback (most recent call last):
02-04 09:14:21.215 16983 24570 I python  :    File "/home/user/sirens/.buildozer/android/app/main.py", line 14, in <module>
02-04 09:14:21.215 16983 24570 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/bleak/__init__.py", line 34, in <module>
02-04 09:14:21.216 16983 24570 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/bleak/backends/p4android/scanner.py", line 16, in <module>
02-04 09:14:21.216 16983 24570 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/bleak/backends/p4android/defs.py", line 28, in <module>
02-04 09:14:21.216 16983 24570 I python  :    File "/home/user/sirens/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/bleakdemo/armeabi-v7a/jnius/reflect.py", line 229, in autoclass
02-04 09:14:21.217 16983 24570 I python  :    File "jnius/jnius_export_func.pxi", line 26, in jnius.jnius.find_javaclass
02-04 09:14:21.217 16983 24570 I python  :    File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception
02-04 09:14:21.217 16983 24570 I python  :  jnius.jnius.JavaException: JVM exception occurred: Didn't find class "com.github.hbldh.bleak.PythonScanCallback" on path: DexPathList[[zip file "/data/app/com.github.hbldh.bleakdemo-z21-1eW84jd7w4EncN4hEw==/base.apk"],nativeLibraryDirectories=[/data/app/com.github.hbldh.bleakdemo-z21-1eW84jd7w4EncN4hEw==/lib/arm, /data/app/com.github.hbldh.bleakdemo-z21-1eW84jd7w4EncN4hEw==/base.apk!/lib/armeabi-v7a, /system/lib, /system/product/lib]] java.lang.ClassNotFoundException
02-04 09:14:21.217 16983 24570 I python  : Python for android ended.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

1reaction
pylogger-htmlcommented, Feb 7, 2022

After some trial and error, I was able to get this example to run on my Android phone. To do this I had to copy the PythonScanCallback.java & PythonBluetoothGattCallback.java files from Bleak to my local directory and explicitly add them as source files in the buildozer.spec (android.add_src). This worked and the application finally ran.

It would be nice to not have to do that or to have a better way of doing things, but any working solution is better than nothing.

0reactions
avzh72commented, Dec 8, 2022

pip3 install buildozer I’ll try to install it again. I use virtualbox with lubuntu 20.04

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android backend — bleak 0.20.0a1 documentation
The Python-for-Android backend classes are found in the bleak.backends.p4android package and are automatically selected when building with ...
Read more >
Use BLE in a cross-platform Windows/Android Kivy app?
Thread to split the BLE and the Kivy app but I still have a problem since I have to import both Kivy and...
Read more >
Top 5 bleak Code Examples
To help you get started, we've selected a few bleak examples, based on popular ways it is used in public projects. Secure your...
Read more >
Not possible to use bleak module with kivy
Importing Bleak module produces an error in kivy even if no object is created or function is called OS: Windows 10 (there is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found