Update Android example app build tools and pubspec path reference#59
Update Android example app build tools and pubspec path reference#59KeeganBeuthin wants to merge 2 commits intokinde-oss:mainfrom
Conversation
WalkthroughUpdated Android example project build configuration: Gradle wrapper updated to 8.11.1, Android and Kotlin plugin versions bumped, and JVM/Gradle memory and JVM options increased in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
example/pubspec.yamlis excluded by!**/*.yaml
📒 Files selected for processing (2)
example/android/gradle/wrapper/gradle-wrapper.properties(1 hunks)example/android/settings.gradle(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: kartuli98
Repo: kinde-oss/kinde-flutter-sdk PR: 27
File: example/lib/state/app_state_manager.dart:110-124
Timestamp: 2025-06-20T10:43:27.820Z
Learning: The PR #27 for the Flutter starter kit example app is designed to work with Kinde Flutter SDK version 1.0.4, where the register() method will return a token if registration is successful. The current build errors are expected since the code targets a future SDK version.
🔇 Additional comments (2)
example/android/settings.gradle (1)
21-21: LGTM: AGP version update is appropriate.The Android Gradle plugin 8.9 supports API level 35 and represents a minor version update from 8.7.3. The update aligns with the Gradle 8.11.1 upgrade.
example/android/gradle/wrapper/gradle-wrapper.properties (1)
5-5: Gradle 8.11.1 is beyond the officially tested range for Kotlin 2.1.0.Kotlin 2.1.0–2.1.10 are fully compatible with Gradle up to 8.6. Gradle versions 8.7–8.10 are also supported, with only one exception: If you use the Kotlin Multiplatform Gradle plugin, you may see deprecation warnings in your multiplatform projects calling the withJava() function in the JVM target. You can also use Gradle and AGP versions up to the latest releases, but if you do, keep in mind that you might encounter deprecation warnings or some new features might not work. Ensure thorough testing of the example app build with Gradle 8.11.1 to verify compatibility.
There was a problem hiding this comment.
Approved.
Before merging, can we update the content of the gradle.properties file (not currently included in this PR) to this:
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=trueI wasn't able to build on my system without adding these changes.
These are the updated gradle.properties settings for latest Flutter projects.
|
@victoreronmosele Thank you, I have added in the change as you have requested as well, now need to get kinde giants to also approve some of the outstanding prs we have currently |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
example/android/gradle.properties
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: kartuli98
Repo: kinde-oss/kinde-flutter-sdk PR: 27
File: example/lib/state/app_state_manager.dart:110-124
Timestamp: 2025-06-20T10:43:27.820Z
Learning: The PR #27 for the Flutter starter kit example app is designed to work with Kinde Flutter SDK version 1.0.4, where the register() method will return a token if registration is successful. The current build errors are expected since the code targets a future SDK version.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: GitGuardian Security Checks
🔇 Additional comments (1)
example/android/gradle.properties (1)
1-2: gradle.properties was newly created, not upgraded.The
gradle.propertiesfile is a new addition and was not modified from a previous state. It was intentionally created with onlyandroid.useAndroidX=trueenabled; there is noandroid.enableJetifierproperty to remove. With AGP 8.9.1 and Kotlin 2.1.0, this AndroidX-only configuration is appropriate for modern dependency management.Likely an incorrect or invalid review comment.
| @@ -1,3 +1,2 @@ | |||
| org.gradle.jvmargs=-Xmx1536M | |||
| org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError | |||
There was a problem hiding this comment.
Reduce excessive heap allocation.
The 8GB heap allocation is extremely high for an example app and may prevent builds on machines with limited RAM (e.g., 8-16GB total). While newer AGP/Gradle versions require more memory, 4GB is typically sufficient for most Android projects.
🔎 Recommended configuration with more conservative memory settings
-org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
+org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=1G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError | |
| org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=1G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError |
🤖 Prompt for AI Agents
In example/android/gradle.properties around line 1, the JVM heap setting is set
to -Xmx8G which is excessive for an example app and may fail on machines with
limited RAM; change it to a more conservative value (e.g., -Xmx4G) and
optionally reduce other memory flags (MaxMetaspaceSize, ReservedCodeCacheSize)
to reasonable defaults so the build can run on typical developer machines,
update the line to use -Xmx4G and adjust related sizes accordingly.
There was a problem hiding this comment.
This is not an issue. This is the default gradle properties for newer Flutter projects.
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Flutter default gradle.properties JVM heap size Xmx8G
💡 Result:
Short answer: Many Flutter Android templates (and Flutter's repo integration tests) set org.gradle.jvmargs=-Xmx8G in gradle.properties; that's intentional to avoid Gradle JVM OOMs on large Android/AGP builds. See Flutter source examples and guidance to raise/lower JVM heap in Gradle docs/Android docs. [1][2][3]
What to do
- To change it, edit android/gradle.properties (or ~/.gradle/gradle.properties) and set, for example:
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 - Android's docs recommend testing 4/6/8 GB if GC dominates build time and note you must set MaxMetaspaceSize when changing defaults. [2]
- Gradle's docs show the default and how to configure org.gradle.jvmargs. [3]
References
- Example Flutter gradle.properties containing -Xmx8G (Flutter repo/integration tests). [1]
- Android Studio / Android build guidance on increasing JVM heap for Gradle (recommend 4/6/8g and MaxMetaspaceSize note). [2]
- Gradle documentation on org.gradle.jvmargs and configuring JVM memory. [3]
@victoreronmosele, you're absolutely right, and thank you for the clarification! I've verified that Flutter's own templates and integration tests do use -Xmx8G as the default JVM heap setting for gradle.properties, and Android's official documentation recommends testing with 4GB, 6GB, or 8GB heap sizes for large Android/AGP builds to avoid out-of-memory errors during Gradle builds.
I apologize for the incorrect suggestion. The configuration in this PR is appropriate for newer Flutter projects.
✏️ Learnings added
Learnt from: victoreronmosele
Repo: kinde-oss/kinde-flutter-sdk PR: 59
File: example/android/gradle.properties:1-1
Timestamp: 2025-12-30T13:26:59.783Z
Learning: In Flutter Android projects, the default gradle.properties JVM heap setting is -Xmx8G with additional memory flags like -XX:MaxMetaspaceSize=4G. This is the standard configuration in newer Flutter project templates and Flutter's own repository to prevent Gradle JVM out-of-memory errors during Android builds.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: kartuli98
Repo: kinde-oss/kinde-flutter-sdk PR: 27
File: example/windows/runner/win32_window.h:15-19
Timestamp: 2025-04-27T22:03:28.459Z
Learning: Files in the example/windows/runner/ directory are auto-generated by the "flutter create ." command and should generally not be modified as they may be overwritten during framework updates.
Learnt from: kartuli98
Repo: kinde-oss/kinde-flutter-sdk PR: 27
File: example/lib/state/app_state_manager.dart:110-124
Timestamp: 2025-06-20T10:43:27.820Z
Learning: The PR #27 for the Flutter starter kit example app is designed to work with Kinde Flutter SDK version 1.0.4, where the register() method will return a token if registration is successful. The current build errors are expected since the code targets a future SDK version.
Changes: