-
Notifications
You must be signed in to change notification settings - Fork 17
[ECO-5566] chore: update Android Gradle build to support the newer Flutter SDK #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| ruby 3.0.1 | ||
| ruby 3.4.5 | ||
| flutter 3.29.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,12 +14,12 @@ android { | |
| compileOptions { | ||
| coreLibraryDesugaringEnabled true | ||
|
|
||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai This change shouldn't affect older android platforms right There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query: 💡 Result: Short answer: You can set sourceCompatibility = JavaVersion.VERSION_17 and compile with JDK 17, but to run Java 17 APIs on older Android versions you must use API desugaring (coreLibraryDesugaring). Not every Java 17 runtime API is desugared; language syntax features that compile to bytecode (records, sealed classes, pattern matching, switch expressions) are handled at compile-time, but newer standard-library APIs (java.time, streams, etc.) require the desugaring library and a sufficiently recent Android Gradle Plugin (AGP). [1][2][3] What to do (minimal working setup)
Caveats / compatibility
References
If you want, I can (a) produce a paste-ready Gradle snippet with the latest desugar_jdk_libs artifact version, or (b) check which specific Java 17 APIs you plan to use and verify whether they're desugared. @sacOO7, this change should not affect older Android platforms because the code properly enables desugaring. Here's why: What happens with Java 17:
Why it's safe in this PR: The code correctly configures desugaring on Line 15:
This means the Android Gradle Plugin will automatically backport Java 17 APIs to work on older Android versions at build time. Minor caveats:
Since this is the example app and you're already using desugaring in both the example and test_integration apps, backward compatibility is maintained. The upgrade from AGP 7.4.0 to 8.12.1 also improves the desugaring support. |
||
| } | ||
|
|
||
| kotlinOptions { | ||
| jvmTarget = JavaVersion.VERSION_1_8 | ||
| jvmTarget = JavaVersion.VERSION_17 | ||
| } | ||
|
|
||
| defaultConfig { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| networkTimeout=10000 | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists | ||
Uh oh!
There was an error while loading. Please reload this page.