doc:appunti:prog:kivy_debian_12_android_11
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:prog:kivy_debian_12_android_11 [2023/10/04 17:31] – [Writing the buildozer.spec file] niccolo | doc:appunti:prog:kivy_debian_12_android_11 [2025/12/01 11:57] (current) – [Kivy version] niccolo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Creating a Kivy app for Android 11 on Debian 12 Bookworm ====== | + | ====== Creating a Kivy app for Android 11-14 on Debian 12 Bookworm ====== |
| + | |||
| + | See also the page **[[kivy_app_in_play_store]]**. | ||
| **[[https:// | **[[https:// | ||
| Line 78: | Line 80: | ||
| ==== Using the new venv install method ==== | ==== Using the new venv install method ==== | ||
| - | FIXME Instead of disabling the externally-managed-environment flag or instead of using the pip3 '' | + | :!: **WARNING**: |
| + | |||
| + | Instead of disabling the externally-managed-environment flag or instead of using the pip3 '' | ||
| <code bash> | <code bash> | ||
| Line 121: | Line 125: | ||
| ==== Prepare the Kivy project in user space ==== | ==== Prepare the Kivy project in user space ==== | ||
| + | |||
| + | :!: **INFO**: This procedure is **required only once** when we start a new projec. | ||
| Now it is time to prepare the Kivy project directory for the build of the Android package. You must check the following: | Now it is time to prepare the Kivy project directory for the build of the Android package. You must check the following: | ||
| Line 132: | Line 138: | ||
| < | < | ||
| + | mkdir openolyimageshare | ||
| cd openolyimageshare | cd openolyimageshare | ||
| buildozer init | buildozer init | ||
| Line 181: | Line 188: | ||
| You can use **presplash.filename** and **icon.filename** to include two artwork in your app. The // | You can use **presplash.filename** and **icon.filename** to include two artwork in your app. The // | ||
| - | In **android.permissions** you must list all the permissions that your app will require from the operating system. If you forget to declare something your app simply will not be able to do that operation. Beware that starting from Android 10 the access to the external | + | In **android.permissions** you must list all the permissions that your app will require from the operating system. If you forget to declare something your app simply will not be able to do that operation. Beware that starting from Android 10 the access to the external |
| - | ^ READ_EXTERNAL_STORAGE | + | ^ READ_EXTERNAL_STORAGE |
| ^ WRITE_EXTERNAL_STORAGE | ^ WRITE_EXTERNAL_STORAGE | ||
| - | ^ CAMERA | + | ^ CAMERA |
| ^ MANAGE_EXTERNAL_STORAGE | ^ MANAGE_EXTERNAL_STORAGE | ||
| - | === Compile SDK vs Target | + | === Target API vs Minimum API vs Compile SDK === |
| - | ==== Compiling the package ==== | + | |
| + | Into the **buildozer.spec** you can define the following: | ||
| + | |||
| + | < | ||
| + | # (int) Target | ||
| + | # | ||
| + | |||
| + | # (int) Minimum API your APK / AAB will support. | ||
| + | # | ||
| + | |||
| + | # (int) Android SDK version to use | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | By setting a **target API** lower than your SDK can support, you can declare what will be the highest Android version that your app is designed to be compatible with. In November 2025 the Google Play Store requires the SDK target 35 (Android 15). | ||
| + | |||
| + | Declaring a **minimum API** you can tell what is the minimum Android version required by your app. We did not declared the android.minapi, | ||
| + | |||
| + | The **compile SDK** is the environment you want to use to create the app, i.e. the SDK you downloaded from Google (which generally support the higher API available at the moment). This will affects what functions and constructs you can use in your program. If you do not specify a version, Buildozer should detect the highest SDK downloaded and use it. | ||
| + | |||
| + | The Android API supported by your Buildozer installation depends upon the version of **python-for-android** (**p4a**) downloaded and installed during your setup. To know what is the **target API supported by your Buildozer installation**, | ||
| + | |||
| + | < | ||
| + | [INFO]: | ||
| + | </ | ||
| + | |||
| + | To know what is the **Android SDK versions available**, | ||
| + | < | ||
| + | ls $HOME/ | ||
| + | android-31 | ||
| + | </ | ||
| + | |||
| + | ^ Android Version | ||
| + | | Android 15 | ||
| + | | Android 14 | ||
| + | | Android 13 | ||
| + | | Android 12L | 32 | | ||
| + | | Android 12 | ||
| + | | Android 11 | ||
| + | | Android 10 | ||
| + | | Android 9 | 28 | | ||
| + | | Android 8.1 | 27 | | ||
| + | | Android 8.0 | 26 | | ||
| + | | Android 7.1 | 25 | | ||
| + | | Android 7.0 | 24 | | ||
| + | | Android 6.0 | 23 | | ||
| + | | Android 5.1 | 22 | | ||
| + | | Android 5.0 | 21 | | ||
| + | |||
| + | ==== Compiling the package | ||
| + | |||
| + | :!: **INFO**: This is **the only procedure** to be executed whenever you want to compile a new version; the **version number** must be updated into the **main.py** source code. | ||
| + | |||
| + | Enter the project directory and edit the **main.py** source code updating the definition of the **%%__version__%%** variable (the **buildozer.spec** will refer this value to create the package name). Then choose to make a debug build: | ||
| < | < | ||
| - | # Choose debug or release build: | ||
| buildozer android debug | buildozer android debug | ||
| - | #buildozer android release | ||
| </ | </ | ||
| + | |||
| + | During this step the directory **$HOME/ | ||
| + | |||
| + | The package will be created into the **bin/** subdirectory, | ||
| + | |||
| + | When you are ready to **publish** your package, you must create the //release// binary: | ||
| + | |||
| + | < | ||
| + | buildozer android release | ||
| + | </ | ||
| + | |||
| + | In this case the package created into the **bin/** subdirectory will be named like **packagename-version-arm64-v8a_armeabi-v7a-release.aab**, | ||
| + | |||
| + | |||
| + | ===== Upgrading the build tools (Android SDK) ===== | ||
| + | |||
| + | As per November 2025, the **Google Play** requires that new packages uploaded to the store are compiled using the **SDK target 35**, this means that you have to declare '' | ||
| + | |||
| + | ==== Buildozer version ==== | ||
| + | |||
| + | To check what version of Buildozer is installed: | ||
| + | |||
| + | < | ||
| + | buildozer --version | ||
| + | </ | ||
| + | |||
| + | You can also ask pip3, using whatever //venv// or //user// variant you used: | ||
| + | |||
| + | < | ||
| + | pip3 list --user | ||
| + | Package | ||
| + | --------------- ------- | ||
| + | buildozer | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | The upgrade should be as simple as running | ||
| + | |||
| + | < | ||
| + | pip3 install --user --upgrade buildozer | ||
| + | </ | ||
| + | |||
| + | ==== Python-for-android version ==== | ||
| + | |||
| + | To check the **python-for-android (p4a) version** installed by your Buildozer setup, enter the '' | ||
| + | |||
| + | < | ||
| + | cd $HOME/ | ||
| + | </ | ||
| + | |||
| + | and check the **pythonforandroid** Pyton module version: | ||
| + | |||
| + | < | ||
| + | python3 | ||
| + | Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux | ||
| + | Type " | ||
| + | >>> | ||
| + | >>> | ||
| + | 2024.01.21 | ||
| + | </ | ||
| + | |||
| + | Upgrading Buildozer will eventually upgrade also the python-for-android version. That **Android dependencies** will be stored inside the project subdirectory **$HOME/ | ||
| + | |||
| + | You may want to require a specific python-for-android version by declaring the **p4a.branch** option into the **buildozer.spec** file: | ||
| + | |||
| + | < | ||
| + | # Use the default version: | ||
| + | #p4a.branch = master | ||
| + | # Use a specific p4a version: | ||
| + | #p4a.branch = v2024.03.12 | ||
| + | # Use the develop version: | ||
| + | #p4a.branch = develop | ||
| + | </ | ||
| + | |||
| + | Remember to refresh the build environment with the '' | ||
| + | |||
| + | ==== Android SDK version ==== | ||
| + | |||
| + | All the SDKs downloaded will be stored into **$HOME/ | ||
| + | |||
| + | The SDK used to compile a specific package depends upon the **android.api** option you declared into the **buildozer.spec** file. | ||
| + | |||
| + | < | ||
| + | cd $HOME/ | ||
| + | vi buildozer.spec | ||
| + | # In the spec file set e.g. android.api = 35 | ||
| + | buildozer android update | ||
| + | buildozer android clean | ||
| + | </ | ||
| + | |||
| + | The above command **does not update Buildozer** nor **python-for-android**, | ||
| + | |||
| + | ==== Kivy version ==== | ||
| + | |||
| + | Usually you just declare that you need Kivy to compile the project by including it into the **requirements** of **buildozer.spec**: | ||
| + | |||
| + | < | ||
| + | requirements = python3, | ||
| + | </ | ||
| + | |||
| + | You may be version specific with the syntax: | ||
| + | |||
| + | < | ||
| + | requirements = python3, | ||
| + | </ | ||
| + | |||
| + | To inspect what version of Kivy was used in building the package, look into the prokect directory: **.buildozer/ | ||
| + | |||
| + | |||
| + | ==== Recompile with the updated components ==== | ||
| + | |||
| + | Once you updated some components, be sure to clean the build environment: | ||
| + | |||
| + | < | ||
| + | buildozer android clean | ||
| + | </ | ||
| + | |||
| + | Once you recompiled the app, look into the project **$HOME/ | ||
| + | |||
| + | <code xml> | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | If the **targetSdkVersion** did not upgrade as expected, verify you issued the '' | ||
| + | |||
| + | Other generally unnecessary cleaning commands are: | ||
| + | |||
| + | < | ||
| + | buildozer android clean_dists | ||
| + | buildozer android clean_builds | ||
| + | buildozer android clean_apk | ||
| + | rm -rf .buildozer/ | ||
| + | </ | ||
| + | |||
| ===== Web Resources ===== | ===== Web Resources ===== | ||
| Line 217: | Line 411: | ||
| * **[[https:// | * **[[https:// | ||
| * **[[https:// | * **[[https:// | ||
| + | * **[[https:// | ||
doc/appunti/prog/kivy_debian_12_android_11.1696433490.txt.gz · Last modified: by niccolo
