User Tools

Site Tools


doc:appunti:prog:kivy_debian_12_android_11

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:prog:kivy_debian_12_android_11 [2025/11/16 17:37] – [Upgrading the build tools] niccolodoc: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://kivy.org/|Kivy]]** is a free and open source Python framework for developing mobile apps, with a single codebase, you will be able to deploy apps on **Windows**, **Linux**, **macOS**, **iOS** and **Android**. In this page I will focus on builing an Android app using a GNU/Linux workstation running Debian 12. **[[https://kivy.org/|Kivy]]** is a free and open source Python framework for developing mobile apps, with a single codebase, you will be able to deploy apps on **Windows**, **Linux**, **macOS**, **iOS** and **Android**. In this page I will focus on builing an Android app using a GNU/Linux workstation running Debian 12.
Line 208: Line 210:
 </file> </file>
  
-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. At the moment Buildozer will try to target API 31 (**Android 12**).+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, so Buildozer choosed API 21 (**Android 5.0.2**). Declaring a **minimum API** you can tell what is the minimum Android version required by your app. We did not declared the android.minapi, so Buildozer choosed API 21 (**Android 5.0.2**).
  
-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. In our case only one SDK was downloaded, and it was SDK API 31.+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**, check the messages log during a build, you will find a line like this: 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**, check the messages log during a build, you will find a line like this:
Line 270: Line 272:
 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 ''android.api = 35'' in **buildozer.spec** file and that you have downloaded the relative 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 ''android.api = 35'' in **buildozer.spec** file and that you have downloaded the relative Android SDK.
  
-To check **Buildozer version** installed:+==== Buildozer version ==== 
 + 
 +To check what version of Buildozer is installed:
  
 <code> <code>
 buildozer --version buildozer --version
 +</code>
 +
 +You can also ask pip3, using whatever //venv// or //user// variant you used:
 +
 +<code>
 +pip3 list --user
 +Package         Version
 +--------------- -------
 +buildozer       1.5.0
 +...
 +</code>
 +
 +The upgrade should be as simple as running
 +
 +<code>
 pip3 install --user --upgrade buildozer pip3 install --user --upgrade buildozer
 </code> </code>
 +
 +==== Python-for-android version ====
  
 To check the **python-for-android (p4a) version** installed by your Buildozer setup, enter the ''.buildozer'' subdirectory of your project: To check the **python-for-android (p4a) version** installed by your Buildozer setup, enter the ''.buildozer'' subdirectory of your project:
Line 294: Line 315:
 </code> </code>
  
-Update the the **Android dependencies** inside the project subdirectory **$HOME/openolyimageshare/buildozer/android/platform/python-for-android**:+Upgrading Buildozer will eventually upgrade also the python-for-android version. That **Android dependencies** will be stored inside the project subdirectory **$HOME/openolyimageshare/buildozer/android/platform/python-for-android**
 + 
 +You may want to require a specific python-for-android version by declaring the **p4a.branch** option into the **buildozer.spec** file: 
 + 
 +<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 
 +</file> 
 + 
 +Remember to refresh the build environment with the ''buildozer android clean'' command. 
 + 
 +==== Android SDK version ==== 
 + 
 +All the SDKs downloaded will be stored into **$HOME/.buildozer/android/platform/android-sdk/platforms/** and are available to compile a package for the user. 
 + 
 +The SDK used to compile a specific package depends upon the **android.api** option you declared into the **buildozer.spec** file.
  
 <code> <code>
Line 301: Line 341:
 # In the spec file set e.g. android.api = 35 # In the spec file set e.g. android.api = 35
 buildozer android update buildozer android update
 +buildozer android clean
 </code> </code>
  
-The above command **does not update Buildozer** nor **python-for-android**, but it downloads the **new Android SDK/API** into your **$HOME/.buildozer/** hierarchy (not into the project directory).+The above command **does not update Buildozer** nor **python-for-android**, but it eventually downloads the **new Android SDK/API** into your **$HOME/.buildozer/** hierarchy (not into the project directory). 
 + 
 +==== Kivy version ==== 
 + 
 +Usually you just declare that you need Kivy to compile the project by including it into the **requirements** of **buildozer.spec**: 
 + 
 +<file> 
 +requirements = python3,kivy,requests,android 
 +</file> 
 + 
 +You may be version specific with the syntax: 
 + 
 +<file> 
 +requirements = python3,kivy==2.3.0,requests,android 
 +</file> 
 + 
 +To inspect what version of Kivy was used in building the package, look into the prokect directory: **.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/packages/kivy/**; you will find a file e.g. **2.3.0.zip**. 
 + 
 + 
 +==== Recompile with the updated components ==== 
 + 
 +Once you updated some components, be sure to clean the build environment: 
 + 
 +<code> 
 +buildozer android clean 
 +</code>
  
 Once you recompiled the app, look into the project **$HOME/openolyimageshare/** for the file **.buildozer/android/platform/build-.../dists/openolyimageshare/AndroidManifest.xml** and verify that it has: Once you recompiled the app, look into the project **$HOME/openolyimageshare/** for the file **.buildozer/android/platform/build-.../dists/openolyimageshare/AndroidManifest.xml** and verify that it has:
Line 313: Line 379:
 </code> </code>
  
-If the **targetSdkVersion** did not upgrade as expected, verify you issued the command +If the **targetSdkVersion** did not upgrade as expected, verify you issued the ''clean'' command.
- +
-<code> +
-buildozer android clean +
-</code>+
  
 Other generally unnecessary cleaning commands are: Other generally unnecessary cleaning commands are:
doc/appunti/prog/kivy_debian_12_android_11.1763311062.txt.gz · Last modified: by niccolo