From ae2d28171991915910ad5c591db973acd624881d Mon Sep 17 00:00:00 2001 From: Sync1211 Date: Mon, 6 Feb 2023 11:05:59 +0100 Subject: [PATCH 1/6] * Removed trailing ";" from replace expression --- build-android/manual-steps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-android/manual-steps.md b/build-android/manual-steps.md index 2493255..ffe3fb2 100644 --- a/build-android/manual-steps.md +++ b/build-android/manual-steps.md @@ -223,7 +223,7 @@ cd $DIR_GIT cp $DIR_P4A/bootstraps/webview/build/src/main/java/org/kivy/android/PythonActivity.java ./ # some sed script doing the dirty work sed -i 's/import android.webkit.WebView;/import im.delight.android.webview.AdvancedWebView;/' PythonActivity.java -sed -i -r 's/\bWebView\b/AdvancedWebView;/g' PythonActivity.java +sed -i -r 's/\bWebView\b/AdvancedWebView/g' PythonActivity.java ``` Not the end yet — From a2730046d841feaa2e1de8c15e9ba87df0f5a423 Mon Sep 17 00:00:00 2001 From: Sync1211 Date: Mon, 6 Feb 2023 12:32:21 +0100 Subject: [PATCH 2/6] + Added keystore arguments for later versions of p4a --- build-android/manual-steps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-android/manual-steps.md b/build-android/manual-steps.md index ffe3fb2..1820869 100644 --- a/build-android/manual-steps.md +++ b/build-android/manual-steps.md @@ -320,7 +320,7 @@ keytool -genkey -v -keystore mykeyfile.key -keyalg RSA -keysize 2048 -validity 1 cd $DIR_GIT/Cat-Printer/build-android/ # <3> # pass the path to keyfile as parameter -./3-formal-build.sh mykeyfile.key +./3-formal-build.sh mykeyfile.key # On later versions of python-for-android, the keystore needs to be specified via "--keystore mykeyfile.key --signkey mykey" # again, feel free to check this file ``` From 565b3599085f5f80797a97674a86e18847bf9255 Mon Sep 17 00:00:00 2001 From: Sync1211 Date: Mon, 6 Feb 2023 12:48:31 +0100 Subject: [PATCH 3/6] + Added a list of errors and their solutions --- build-android/manual-steps.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build-android/manual-steps.md b/build-android/manual-steps.md index 1820869..0fc6db0 100644 --- a/build-android/manual-steps.md +++ b/build-android/manual-steps.md @@ -333,6 +333,19 @@ If it also worked, congrats again! Try the ultimate helper `1-build.sh`, if you also have everything in [development.md](../development.md) done. +## Troubleshooting + +Common issues and fixes: + +| Error message | Fix | +|-|-| +| path may not be null or empty string. path='null' | Keystore needs to be specified via `--keystore ` | +| `/usr/bin/javac` is missing | JDK needs to be installed and selected as active java installation. | +| setuptools could not be imported | Fixed by specifying a different python version by adding `--requirements=pip,setuptools,wheel,hostpython3==3.9.16,python3==3.9.16` | +| No such file or directory `bleak/setup.py` | Run `2-clean-up-build.sh` or specify a different python version via the arguments provided above | +| No such file or directory `build-android/dist` | Create a bare bundle before creating an APK | + + ## The End You made it! You now have ability to contribute much more, outside of Cat-Printer. Try to bring an app in your mind to reality, with just Python, Web, and this build environment. From 9c3e959a242f507ad0279991b78d43f661494f9e Mon Sep 17 00:00:00 2001 From: Sync1211 Date: Fri, 10 Feb 2023 09:45:26 +0100 Subject: [PATCH 4/6] + Added another troubleshooting case * Replaced "/mnt/@/" with a DIR_BUILD variable * --- build-android/manual-steps.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/build-android/manual-steps.md b/build-android/manual-steps.md index 0fc6db0..7f9d94d 100644 --- a/build-android/manual-steps.md +++ b/build-android/manual-steps.md @@ -53,8 +53,14 @@ Make 3 folders inside: ### Git Repositories ```bash -# Remember to use your path -DIR_GIT="/mnt/data/@/git-repo/" +# Define your build directories +DIR_BUILD="/mnt/data/@" +DIR_GIT="$DIR_BUILD/git-repo/" + +# Make sure both directories exist +mkdir -p $DIR_BUILD +mkdir -p $DIR_GIT + cd $DIR_GIT # Cat-Printer @@ -116,8 +122,8 @@ System doesn’t understand it. Let’s replace them as symlinks: ```bash # you may already have these from p4a guide -ANDROIDSDK="/mnt/data/@/android" -ANDROIDNDK="/mnt/data/@/android/android-ndk-r23b" +ANDROIDSDK="$DIR_BUILD/android" +ANDROIDNDK="$DIR_BUILD/android/android-ndk-r23b" # feel free to check this script python3 $DIR_GIT/Cat-Printer/build-android/fix-ndk-execs.py $ANDROIDNDK ``` @@ -175,15 +181,15 @@ The most tricky fact is that none of these things work out-of-the-box. We should glue them up by hand. ```bash -# let’s put those environment variables required by python-for-android here -nano ~/.bashrc -# append in the end. use your target paths! -export ANDROIDSDK="/mnt/data/@/android" -export ANDROIDNDK="/mnt/data/@/android/android-ndk-r23b" +# append target paths and environment variables required by python-for-android (adjust if necessary) +echo ' +export DIR_BUILD="/mnt/data/@" +export ANDROIDSDK="$DIR_BUILD/android" +export ANDROIDNDK="$DIR_BUILD/android/android-ndk-r23b" export ANDROIDAPI="30" -export NDKAPI="21" +export NDKAPI="21"' >> .bashrc -# after that, apply these +# reload environment variables source ~/.bashrc ``` @@ -191,12 +197,12 @@ source ~/.bashrc ```bash # define shortcut(s). use your target paths! -DIR_GIT="/mnt/data/@/git-repo/" +DIR_GIT="$DIR_BUILD/git-repo/" DIR_P4A="/usr/local/lib/python3.10/dist-packages/pythonforandroid/" # p4a will generate some intermediate data. “expose” this to the host for convenient manipulation. mkdir -p ~/.local/share/ -ln -s /mnt/data/@/p4a/ ~/.local/share/python-for-android +ln -s $DIR_BUILD/p4a/ ~/.local/share/python-for-android # give p4a the bleak recipe. fortunately, p4a will resolve this symlink ln -s $DIR_GIT/bleak/bleak/backends/p4android/recipes/bleak $DIR_P4A/recipes/bleak @@ -344,7 +350,7 @@ Common issues and fixes: | setuptools could not be imported | Fixed by specifying a different python version by adding `--requirements=pip,setuptools,wheel,hostpython3==3.9.16,python3==3.9.16` | | No such file or directory `bleak/setup.py` | Run `2-clean-up-build.sh` or specify a different python version via the arguments provided above | | No such file or directory `build-android/dist` | Create a bare bundle before creating an APK | - +| JAVA_HOME is not set and no 'java' command could be found in your PATH. | Install a JDK (e.g. `openjdk-19-jdk`) | ## The End From 9d7dc375dd9eb91101dfd3d69d7c68d60ce45eb0 Mon Sep 17 00:00:00 2001 From: Sync1211 Date: Fri, 10 Feb 2023 10:37:29 +0100 Subject: [PATCH 5/6] * Updated "--requirements" argument in the troubleshooting section --- build-android/manual-steps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-android/manual-steps.md b/build-android/manual-steps.md index 7f9d94d..47bc9b8 100644 --- a/build-android/manual-steps.md +++ b/build-android/manual-steps.md @@ -347,7 +347,7 @@ Common issues and fixes: |-|-| | path may not be null or empty string. path='null' | Keystore needs to be specified via `--keystore ` | | `/usr/bin/javac` is missing | JDK needs to be installed and selected as active java installation. | -| setuptools could not be imported | Fixed by specifying a different python version by adding `--requirements=pip,setuptools,wheel,hostpython3==3.9.16,python3==3.9.16` | +| setuptools could not be imported | Fixed by specifying a different python version by adding `--requirements=pip,setuptools,wheel,hostpython3==3.9.16,python3==3.9.16,$(cat build-deps.txt)` | | No such file or directory `bleak/setup.py` | Run `2-clean-up-build.sh` or specify a different python version via the arguments provided above | | No such file or directory `build-android/dist` | Create a bare bundle before creating an APK | | JAVA_HOME is not set and no 'java' command could be found in your PATH. | Install a JDK (e.g. `openjdk-19-jdk`) | From c4fdfc491254d733537c8c675908cc92fedfc1b5 Mon Sep 17 00:00:00 2001 From: Sync1211 Date: Fri, 10 Feb 2023 12:00:09 +0100 Subject: [PATCH 6/6] + Added alternative solution for bleak/setup.py not being found --- build-android/manual-steps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-android/manual-steps.md b/build-android/manual-steps.md index 47bc9b8..1830dd4 100644 --- a/build-android/manual-steps.md +++ b/build-android/manual-steps.md @@ -348,7 +348,7 @@ Common issues and fixes: | path may not be null or empty string. path='null' | Keystore needs to be specified via `--keystore ` | | `/usr/bin/javac` is missing | JDK needs to be installed and selected as active java installation. | | setuptools could not be imported | Fixed by specifying a different python version by adding `--requirements=pip,setuptools,wheel,hostpython3==3.9.16,python3==3.9.16,$(cat build-deps.txt)` | -| No such file or directory `bleak/setup.py` | Run `2-clean-up-build.sh` or specify a different python version via the arguments provided above | +| No such file or directory `bleak/setup.py` | Run `2-clean-up-build.sh` or [download the bleak source code from PyPi](https://pypi.org/project/bleak/#files) | | No such file or directory `build-android/dist` | Create a bare bundle before creating an APK | | JAVA_HOME is not set and no 'java' command could be found in your PATH. | Install a JDK (e.g. `openjdk-19-jdk`) |