Skip to content

fix(android): update template to use gradle 9 - #15828

Merged
Legend-Master merged 31 commits into
tauri-apps:devfrom
Legend-Master:gradle-9-compatible
Aug 10, 2026
Merged

Legend-Master merged 31 commits into
tauri-apps:devfrom
Legend-Master:gradle-9-compatible

Conversation

@Legend-Master

Copy link
Copy Markdown
Contributor

Built on top of #15335 as a non-breaking version for v2

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Package Changes Through f1afdd9

There are 14 changes which include tauri with minor, tauri-cli with minor, @tauri-apps/cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-bundler with minor, tauri-build with minor, tauri-macos-sign with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-driver with minor, @tauri-apps/api with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.11.1 2.12.0
tauri-utils 2.9.3 2.10.0
tauri-macos-sign 2.3.4 2.4.0
tauri-bundler 2.9.4 2.10.0
tauri-runtime 2.11.3 2.12.0
tauri-runtime-wry 2.11.4 2.12.0
tauri-codegen 2.6.3 2.7.0
tauri-macros 2.6.3 2.7.0
tauri-plugin 2.6.3 2.7.0
tauri-build 2.6.3 2.7.0
tauri 2.11.5 2.12.0
@tauri-apps/cli 2.11.4 2.12.0
tauri-cli 2.11.4 2.12.0
tauri-driver 2.0.6 2.1.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master

Copy link
Copy Markdown
Contributor Author

@FabianLars do you have the patient to verify this on an older tauri android init project? I have tested the current version against the existing dialog plugin without any problems, but I really don't have the mental power to deal with any java today anymore 😂

@FabianLars

Copy link
Copy Markdown
Member

so basically just testing tauri-build? no errors, seems to work.

@Legend-Master

Copy link
Copy Markdown
Contributor Author

Yeah.. maybe also test it in plugins-workspace?

Also super confused about the Supplied consumer proguard configuration does not exist error, not sure what change caused it 😩

@FabianLars

Copy link
Copy Markdown
Member

yeah i see no errors in plugins-workspace either, everything seems to work correctly.

after rerunning android init i can't spot the proguard error you mentioned but it may be hidden in the shitton of deprecation warnings 😅

@Legend-Master

Copy link
Copy Markdown
Contributor Author

That error only seem to appear in release build

https://github.com/tauri-apps/tauri/actions/runs/30993665742/job/92265472029?pr=15828

@Legend-Master

Legend-Master commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Ok, so #6257 broke everything... It removed the consumer-rules.pro that is used in our setup and kept the proguard-rules.pro which is only used when compiling the library to AAR (which we don't do). (See a48ec22 for the correct setup)

This sucks so much now that all of the plugins generated before were consistently wrong that we can't really do this without some hacky work around now. 😢

getByName("release") {
isMinifyEnabled = true
optimization {
enable = true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This also includes getDefaultProguardFile("proguard-android-optimize.txt")

https://developer.android.com/topic/performance/app-optimization/enable-app-optimization#optimization-dsl

@Legend-Master

Copy link
Copy Markdown
Contributor Author

So weird that I can't reproduce this CI error locally 🤔 @FabianLars could you reproduce this error locally?

https://github.com/tauri-apps/tauri/actions/runs/31077292683/job/92538010315?pr=15828

@Legend-Master
Legend-Master marked this pull request as ready for review August 6, 2026 08:05
@Legend-Master
Legend-Master requested a review from a team as a code owner August 6, 2026 08:05
@Legend-Master

Copy link
Copy Markdown
Contributor Author

I have tested this PR against plugins-workspace without tauri-apps/plugins-workspace#3531 and it seems to work both on release build and dev build, also tested with tauri android init in the API example. I still couldn't reproduce the error from CI though... I'm on JDK 25 + NDK 29 if that's useful.

@Legend-Master Legend-Master added this to the 2.12 milestone Aug 6, 2026
@Legend-Master

Legend-Master commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor Author

After crap ton of debugging, it might be the apply(from = "tauri.build.gradle.kts") that's causing the problem... Like wtf

https://issuetracker.google.com/issues/463283604

Edit: yeah, confirmed, it needs to be apply(from = file("tauri.build.gradle.kts")) now, fixed in adf914a

reference: https://issuetracker.google.com/issues/463283604#comment10

@Legend-Master
Legend-Master merged commit e2e585a into tauri-apps:dev Aug 10, 2026
32 checks passed
@Legend-Master
Legend-Master deleted the gradle-9-compatible branch August 10, 2026 08:28
okhsunrog added a commit to okhsunrog/floppa-vpn that referenced this pull request Aug 30, 2026
Taken from the Tauri template at the commit this repo already pins for
tauri itself (tauri-apps/tauri#15828). Gradle 8.14.3 → 9.6.1, AGP 8.13.2
→ 9.3.1, Kotlin 2.2.0 → 2.2.10, compileSdk and targetSdk 36 → 37, and
`buildSrc` rewritten the way Gradle 9 wants it: `tasks.register` instead
of `maybeCreate`, and the project directory carried as an `@Input` string
rather than a `File` field the configuration cache cannot serialise.

What this was for is the ceiling we had already documented and stopped at:
androidx `core-ktx` was held at 1.17.0 and lint's `GradleDependency` check
was switched off, because 1.18+ wants compileSdk 37 and AGP 9.1. Both are
back — core-ktx 1.19.0, appcompat 1.8.0, and the check enabled again.

Three places deviate from the template, each for a reason:

- JVM target stays 17 for our two modules where the template says 1.8. The
  androidx libraries they inline from are built for JVM 11, and Kotlin
  refuses to inline higher bytecode into lower. The Tauri modules can stay
  at 1.8 because inlining the other way is allowed.
- the release build keeps `getDefaultProguardFile("proguard-android-optimize.txt")`,
  which the template dropped. This app reaches its own Kotlin from JNI and
  the shrinker is the one part of the build that fails silently — a class
  it removes shows up as a tunnel that will not start, not as a build
  error. Same file set as before; only the DSL changed.
- two lint checks are disabled, both false for a library module read on its
  own: `ForegroundServicePermission`, which knows one exemption path for
  `systemExempted` and not ours, which is being a VpnService; and
  `QueryPermissionsNeeded`, which cannot see that `QUERY_ALL_PACKAGES` is
  declared in the app manifest and merged in.

Our local `consumerProguardFiles.removeAll { !it.exists() }` workaround is
gone — upstream replaced it with `android.proguard.failOnMissingFiles`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants