QGB / kivy_termux

kivy call termux python
1 stars 0 forks source link

python #1

Open QGB opened 1 year ago

QGB commented 1 year ago

chmod 777 /data
chmod 777 /data/data
chmod 777 /data/data/com.termux/files/
chmod 777 /data/data/com.termux/files/usr
chmod 777 /data/data/com.termux/files/usr/bin/
chmod 777 /data/data/com.termux/files/usr/bin/python 

# 不用 export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
#  chmod 777 /data/data/com.termux/files/usr/lib/libtermux-exec.so

chmod 777 /data/data/com.termux/files/usr/lib/
chmod 777 /data/data/com.termux/files/usr/lib/libandroid-support.so

chmod 777 /data/data/com.termux/files/usr/lib/libpython3.10.so.1.0

cd /data/data/com.termux/files/usr/lib/python3.10
/data/data/com.termux/files/usr/lib/python3.10 # find $PWD -exec chmod 777 {} \;
QGB commented 1 year ago
/data/data/qgb.ble/files # su u0_a161

angler:/data/data/qgb.ble/files/app/qgb $ /data/data/com.termux/files/usr/bin/python
Python 3.10.5 (main, Jun  7 2022, 03:52:12) [Clang 12.0.8 (https://android.googlesource.com/toolchain/llvm-project c935d99d7 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
QGB commented 1 year ago

cp -a -r /data/data/com.termux/files/usr/lib/python3.10 /data/data/com.termux/files/usr/lib/libandroid-support.so /data/data/com.termux/files/usr/lib/libpython3.10.so.1.0 ./

QGB commented 11 months ago

docker run -it --privileged=true -v /root/docker/buildozer/user:/home/user -v /:/all -w /home/user/KivyJniusBluetoothApp/ --entrypoint /bin/bash kivy/buildozer -c 'buildozer android debug;exec bash'

大概需要两分钟
f=/home/user/KivyJniusBluetoothApp/bin/ble-0.1-armeabi-v7a-debug.apk;rm $f;buildozer android debug;ls -al  $f;/home/user/.buildozer/android/platform/android-sdk/platform-tools/adb install -r $f

[DEBUG]:   
[DEBUG]:        You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[DEBUG]:        > IDLE
[DEBUG]:        See https://docs.gradle.org/7.4.1/userguide/command_line_interface.html#sec:command_line_warnings
[DEBUG]:   
[DEBUG]:        BUILD SUCCESSFUL in 37s
[DEBUG]:        30 actionable tasks: 30 executed

[INFO]:    <- directory context /home/user/KivyJniusBluetoothApp/.buildozer/android/platform/python-for-android
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:         ble: min API 21, includes recipes (hostpython3, libffi, openssl, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3, sdl2, pytz, setuptools, flask, psutil, six, pyjnius, android, kivy, werkzeug, certifi, idna, cchardet, wcwidth, itsdangerous, chardet, markupsafe, dill, urllib3, click, requests, jinja2, kivymd), built for archs (armeabi-v7a)
[INFO]:    ble has compatible recipes, using this one
[INFO]:    # Copying android package to current directory
[INFO]:    # Android package filename not found in build output. Guessing...
[INFO]:    # Found android package file: /home/user/KivyJniusBluetoothApp/.buildozer/android/platform/build-armeabi-v7a/dists/ble/build/outputs/apk/debug/ble-debug.apk
[INFO]:    # Add version number to android package
[INFO]:    # Android package renamed to ble-debug-0.1.apk
[DEBUG]:   -> running cp /home/user/KivyJniusBluetoothApp/.buildozer/android/platform/build-armeabi-v7a/dists/ble/build/outputs/apk/debug/ble-debug.apk ble-debug-0.1.apk
WARNING: Received a --sdk argument, but this argument is deprecated and does nothing.
No setup.py/pyproject.toml used, copying full private data into .apk.
Applying Java source code patches...
Applying patch: src/patches/SDLActivity.java.patch
Warning: failed to apply patch (exit code 1), assuming it is already applied:  src/patches/SDLActivity.java.patch
# Android packaging done!
# APK ble-0.1-armeabi-v7a-debug.apk available in the bin directory

user@e95c69c23f81:~/KivyJniusBluetoothApp$ ps -A
  PID TTY          TIME CMD
    1 pts/0    00:00:00 bash
  199 ?        00:03:15 java
  589 pts/0    00:00:00 ps