Skip to content

Update Android Gradle Plugin to 8.11.0 and Gradle Wrapper to 8.14.3 + update default API target to 35 in tests #3172

Merged
misl6 merged 8 commits intokivy:developfrom
FilipeMarch:develop
Jul 22, 2025
Merged

Update Android Gradle Plugin to 8.11.0 and Gradle Wrapper to 8.14.3 + update default API target to 35 in tests #3172
misl6 merged 8 commits intokivy:developfrom
FilipeMarch:develop

Conversation

@FilipeMarch
Copy link
Contributor

Already tested here and it's working fine:
On buildozer.spec:

android.api = 36
android.minapi = 24
p4a.source_dir = /home/kivyschool/python-for-android
[INFO]:    Will compile for the following archs: arm64-v8a
[INFO]:    Found Android API target in $ANDROIDAPI: 36
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/kivyschool/.buildozer/android/platform/android-ndk-r25b
[INFO]:    Found NDK version 25b
[DEBUG]:   
[DEBUG]:   	Welcome to Gradle 8.14.3!
[DEBUG]:   	
[DEBUG]:   	Here are the highlights of this release:
[DEBUG]:   	 - Java 24 support
[DEBUG]:   	 - GraalVM Native Image toolchain selection
[DEBUG]:   	 - Enhancements to test reporting
[DEBUG]:   	 - Build Authoring improvements
[DEBUG]:   
[DEBUG]:        BUILD SUCCESSFUL in 12s
[DEBUG]:        34 actionable tasks: 33 executed, 1 up-to-date
[DEBUG]:   

Summary

  • gradle-wrapper.properties: distributionUrl now points to gradle‑8.14.3‑all.zip
  • build.tmpl.gradle:
    • classpath updated from 'com.android.tools.build:gradle:8.1.1' to 'com.android.tools.build:gradle:8.11.0'
    • Repository mirror updated from jcenter() to mavenCentral().

Motivation

I tried to compile my application using android.api = 36 but started getting these logs:

[INFO]:    Detected highest available build tools version to be 36.0.0
[DEBUG]:   -> running gradlew clean assembleDebug
[DEBUG]:       WARNING: We recommend using a newer Android Gradle plugin to use compileSdk = 36
[DEBUG]:       
[DEBUG]:       This Android Gradle plugin (8.1.1) was tested up to compileSdk = 34.
[DEBUG]:       
[DEBUG]:       You are strongly encouraged to update your project to use a newer
[DEBUG]:       Android Gradle plugin that has been tested with compileSdk = 36.
[DEBUG]:       
[DEBUG]:       If you are already using the latest version of the Android Gradle plugin,
[DEBUG]:       you may need to wait until a newer version with support for compileSdk = 36 is available.
[DEBUG]:       
[DEBUG]:       To suppress this warning, add/update
[DEBUG]:           android.suppressUnsupportedCompileSdk=36
[DEBUG]:       to this project's gradle.properties.
[DEBUG]:       
[DEBUG]:       > Task :processDebugMainManifest
[DEBUG]:       /home/kivyschool/test/.buildozer/android/platform/build-arm64-v8a/dists/kivy_reloader/src/main/AndroidManifest.xml:55:18-50 Warning:
[DEBUG]:               android:extractNativeLibs should not be specified in this source AndroidManifest.xml file. See https://d.android.com/guide/topics/manifest/application-element#extractNativeLibs for more information.
[DEBUG]:       The AGP Upgrade Assistant can remove the attribute from the AndroidManifest.xml file and update the build file accordingly. See https://d.android.com/studio/build/agp-upgrade-assistant for more information.
[DEBUG]:       
[DEBUG]:       > Task :compileDebugJavaWithJavac
[DEBUG]:       Note: Some input files use or override a deprecated API.
[DEBUG]:       Note: Recompile with -Xlint:deprecation for details.
[DEBUG]:       
[DEBUG]:       Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

After some investigation:
image
image

  • Play Console enforces targetSdkVersion ≥ 35; this requires AGP ≥ 8.6 and Gradle ≥ 8.13.
  • Gradle 8.14.3 satisfies the toolchain floor for AGP 8.11.0.
  • jcenter() is deprecated; switching to mavenCentral() removes a dead dependency source.

@misl6
Copy link
Member

misl6 commented Jul 14, 2025

I tried to build with a slightly different version (been more conservative), a few days ago, and also seemed fine to me.
I see the automated tests are failing, did you already tried to reproduce it locally?

UPDATE: I see the issue might be the current default target SDK, I guess we should just increase it. 😄

@kuzeyron kuzeyron added the core-providers Core code that's not a recipe label Jul 15, 2025
@misl6
Copy link
Member

misl6 commented Jul 15, 2025

Checked test results after latest changes, APP_PLATFORM := $(NDK_API) in Application.mk might be missing for web view and library 😬

@FilipeMarch
Copy link
Contributor Author

Hum... got 32 passed, 1 failed here; it seems something went wrong on service_library

@Novfensec
Copy link
Contributor

Novfensec commented Jul 16, 2025

Latest stable NDK to build for android.api = 36 is r28c. So The default minimum should be r28c for newer builds. Also using ndk>=r28 will force 16KiB alignement as default.

To override this behavior we can do below:
This may not work as android may reject .so files

CMakeLists.txt:

set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=4096")

Android.mk:

LOCAL_LDFLAGS += -Wl,-z,max-page-size=4096

Overall we need to first add 16KiB support.

@T-Dynamos
Copy link
Member

@Novfensec SDL won't build in latest NDK until #3164 is pushed.

Ref: #3136 (comment)

@misl6
Copy link
Member

misl6 commented Jul 22, 2025

Hum... got 32 passed, 1 failed here; it seems something went wrong on service_library

APP_ABI := $(ARCH) in Application.mk of service_library is missing :)

Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@misl6 misl6 changed the title Update Android Gradle Plugin to 8.11.0 and Gradle Wrapper to 8.14.3 Update Android Gradle Plugin to 8.11.0 and Gradle Wrapper to 8.14.3 + update default API target to 35 in tests Jul 22, 2025
@misl6 misl6 merged commit a8f2ca1 into kivy:develop Jul 22, 2025
33 checks passed
SomberNight pushed a commit to SomberNight/python-for-android that referenced this pull request Jan 29, 2026
…3` + update default API target to `35` in tests (kivy#3172)

* 🔧 build: upgrade Gradle wrapper to `8.14.3`

* `distributionUrl` now points to `gradle‑8.14.3‑all.zip`

* 🔧 build: bump AGP to `8.11.0`, replace `jcenter()` with `mavenCentral()`

* Update `android-api` to 35 in `testapps/on_device_unit_tests/setup.py`

* Update target android.api to 35 in buildozer.spec

* Update `ANDROID_API_LEVEL` to 35 in `android.mk`

* Set `APP_PLATFORM` in `Application.mk` to use `NDK_API`

* Add `Application.mk` with `APP_PLATFORM` for service_library bootstrap

Hopefully [this](https://github.com/kivy/python-for-android/actions/runs/16309986846/job/46063689527?pr=3172) will pass

* Define `APP_ABI` variable in `Application.mk` for arch targeting

-----

cherry-pick of kivy@a8f2ca1
from kivy#3172
(minus the unit test changes, as they conflict)
(plus qt6 equivalent change)
SomberNight added a commit to SomberNight/electrum that referenced this pull request Jan 29, 2026
When building on debian 12, we were using Java 17.
On debian 13, there is Java 21.

Gradle was giving build errors with new Java:
```
Could not compile build file '/home/user/wspace/electrum/.buildozer_qml/android/platform/build-arm64-v8a/dists/Electrum/build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 65

java.lang.IllegalArgumentException: Unsupported class file major version 65
```

see https://docs.gradle.org/current/userguide/compatibility.html

for our p4a fork, this cherry-picks:
- kivy/python-for-android@17bf532
- kivy/python-for-android#3172
    kivy/python-for-android@a8f2ca1
SomberNight added a commit to SomberNight/electrum that referenced this pull request Jan 29, 2026
When building on debian 12, we were using Java 17.
On debian 13, there is Java 21.

Gradle was giving build errors with new Java:
```
Could not compile build file '/home/user/wspace/electrum/.buildozer_qml/android/platform/build-arm64-v8a/dists/Electrum/build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 65

java.lang.IllegalArgumentException: Unsupported class file major version 65
```

see https://docs.gradle.org/current/userguide/compatibility.html

for our p4a fork, this cherry-picks:
- kivy/python-for-android@17bf532
- kivy/python-for-android#3172
    kivy/python-for-android@a8f2ca1
SomberNight added a commit to SomberNight/electrum that referenced this pull request Jan 30, 2026
When building on debian 12, we were using Java 17.
On debian 13, there is Java 21.

Gradle was giving build errors with new Java:
```
Could not compile build file '/home/user/wspace/electrum/.buildozer_qml/android/platform/build-arm64-v8a/dists/Electrum/build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 65

java.lang.IllegalArgumentException: Unsupported class file major version 65
```

see https://docs.gradle.org/current/userguide/compatibility.html

for our p4a fork, this cherry-picks:
- kivy/python-for-android@17bf532
- kivy/python-for-android#3172
    kivy/python-for-android@a8f2ca1

---

However this still does not work yet:
- contrib/android/make_barcode_scanner.sh fails, as
    markusfisch/zxing-cpp and markusfisch/CameraView
    are also using too old gradle versions for Java 21
    - it they are intentionally doing this to maintain compat with Android 4:
        see markusfisch/zxing-cpp@d98ed5d

so for now maybe the path of least resistance is to downgrade to Java 17?
SomberNight added a commit to SomberNight/electrum that referenced this pull request Jan 30, 2026
When building on debian 12, we were using Java 17.
On debian 13, Java 17 is not packaged anymore, instead there is Java 21 and 25.
Ideally we should upgrade to Java 21 and just install it from apt.

However old Gradle is not compatible with new Java, so we have to upgrade Gradle for that.
- see https://docs.gradle.org/current/userguide/compatibility.html

Old Gradle is giving build errors with Java 21:
```
Could not compile build file '/home/user/wspace/electrum/.buildozer_qml/android/platform/build-arm64-v8a/dists/Electrum/build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 65

java.lang.IllegalArgumentException: Unsupported class file major version 65
```

for our p4a fork, I tried to cherry-pick stuff from upstream:
- kivy/python-for-android@17bf532
- kivy/python-for-android#3172
    kivy/python-for-android@a8f2ca1
- see SomberNight/python-for-android@a01269f...846a109

That seems sufficient to upgrade Gradle as far as p4a is concerned.

However that still did not work yet:
- contrib/android/make_barcode_scanner.sh fails, as
    markusfisch/zxing-cpp and markusfisch/CameraView
    are also using too old gradle versions for Java 21
    - it seems they are intentionally doing this to maintain compat with Android 4:
        see markusfisch/zxing-cpp@d98ed5d

So for now maybe the path of least resistance is to downgrade to Java 17 :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-providers Core code that's not a recipe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants