Skip to content

Fix native library stripping by using matching NDK version for AGP 8.6.1#66

Merged
nain-F49FF806 merged 5 commits intonain-F49FF806:mainfrom
inventory69:fix/ndk-version-for-agp-8.6
Jan 7, 2026
Merged

Fix native library stripping by using matching NDK version for AGP 8.6.1#66
nain-F49FF806 merged 5 commits intonain-F49FF806:mainfrom
inventory69:fix/ndk-version-for-agp-8.6

Conversation

@inventory69
Copy link
Contributor

Fixes #11

The issue was that we're using AGP 8.6.1 but didn't specify which NDK version to use. This caused inconsistent behavior where debug symbols weren't being stripped properly, making the APKs way bigger than necessary.

Changes

  • Set NDK to 27.0.12077973 (the default NDK for AGP 8.6.1) in gradle.properties and both gradle build files
  • Updated CI workflow to install the correct NDK version before building
  • Removed the old hardcoded NDK version (25.1.8937393) from app/build.gradle.kts

According to the AGP 8.6 release notes, AGP automatically strips debug symbols when using its tested NDK version. By matching them up, we should get properly stripped libraries without the bloat.

Tested locally with `./gradlew build --dry-run` - no errors.

inventory69 and others added 3 commits January 6, 2026 09:04
- Set NDK version to 27.0.12077973 (default for AGP 8.6.1)
- Updated CI workflow to install correct NDK version
- Removed old hardcoded NDK version (25.1.8937393)

Fixes nain-F49FF806#11
@inventory69
Copy link
Contributor Author

inventory69 commented Jan 6, 2026

The build failure is not related to the changes in this PR - it's a temporary Maven Central issue:

Could not GET 'https://repo.maven.apache.org/maven2/.../kotlin-serialization-compiler-plugin-embeddable/2.0.21/...pom'
Received status code 403 from server: Forbidden

This happens sometimes when Maven Central rate-limits GitHub Actions IPs or has temporary availability issues. A re-run of the workflow should fix it.

@nain-F49FF806
Copy link
Owner

@inventory69 Yes. Let's wait for the rate limit window to pass. Will run this again in a couple of hours.

@nain-F49FF806
Copy link
Owner

Thanks for the PR, @inventory69. Nice work!
It definitely achieves the desired behavior of stripping the libs. :)

A quick question on the NDK version though: You mentioned that 27.0.12077973 is the default for AGP 8.6.1, but the AGP 8.6 release notes list 26.1.10909125 as the default. Could you share where you found that specific version number?

@nain-F49FF806
Copy link
Owner

nain-F49FF806 commented Jan 6, 2026

Also want to say: I really like the way you harmonized the version across the build configs (both) and environment variables. It's a much more robust setup. This level of consistency is exactly what we need.

That said, I wonder if we could get away with simply using a consistent NDK version, rather than matching the AGP with a 'magic' NDK number.

While keeping your changes, would using the default 26.1.10909125 everywhere achieve the same result?

@inventory69
Copy link
Contributor Author

inventory69 commented Jan 6, 2026

@nain-F49FF806 Thanks for the feedback, I really appreciate it!

Even though I made a mistake and assumed the version 27.0.12077973 is the default one, which is obviously not..
This was a version number I used in one of my flutter builds and it worked well, I thought it's the default one for that AGP Version.

Now we have 2 options, we can stick to the newer ndk which works well.
Or we switch to the official tested version you mentioned which the release notes lists 26.1.10909125.
The second option would be the cleaner one as we would strictly adhere to the official docs. (Edit: Works, tested it with ./gradlew clean build --dry-run)

Using a version number like 26.1 or 27.0 would not work because AGP doesn't accept it unfortunately.

Copy link
Owner

@nain-F49FF806 nain-F49FF806 left a comment

Choose a reason for hiding this comment

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

Thanks for confirming it works with the default NDK version. This is very promising.
To keep this easy to maintain across modules, I've suggested centralising the versioning.

Let's get those minor changes in, and we are good to go!

- Rename property to PROJECT_NDK_VERSION for clarity
- Change version to 26.1.10909125 (official AGP 8.6 default)
- Use gradleProperty() in build scripts for single source of truth
- Update CI workflow to match new NDK version

Addresses review feedback from @nain-F49FF806
@inventory69
Copy link
Contributor Author

@nain-F49FF806 Hey, i've implemented all the requested changes in Commit 7635762.
Thanks for your time! :)

The ndkVersion property expects a String, not a Provider<String>.
Calling .get() resolves the provider to its actual value.
@nain-F49FF806
Copy link
Owner

lgtm!

@nain-F49FF806 nain-F49FF806 merged commit a7bcda2 into nain-F49FF806:main Jan 7, 2026
1 check passed
@nain-F49FF806
Copy link
Owner

nain-F49FF806 commented Jan 7, 2026

Thank you for your contribution @inventory69 !
This will be part of the next release.

@inventory69
Copy link
Contributor Author

inventory69 commented Jan 7, 2026

@nain-F49FF806 You're welcome! I am glad that I could help, as I really like your project!

@inventory69 inventory69 deleted the fix/ndk-version-for-agp-8.6 branch January 7, 2026 23:03
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.

Figure out matching sdk/agp/ndk for well stripped native libs

2 participants