Conversation
📝 WalkthroughWalkthroughAdd Foojay resolver and androidKotlinMultiplatformLibrary plugin, bump Gradle/AGP/Kotlin/Compose versions and toolchain settings, migrate Compose artifacts to JetBrains coordinates, switch JS/WASM rendering from canvas to a div-based ComposeViewport flow, and add a dedicated Android sample module. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant HTML as "index.html (div)"
participant Wasm as "WASM module"
participant Compose as "ComposeViewport"
Browser->>HTML: Load page with <div id="ComposeTarget">
HTML->>Wasm: Load composeApp-*.js
Wasm->>Wasm: configureWebResources(mapping "./<path>")
Wasm->>Wasm: onWasmReady triggers
Wasm->>Compose: initialize ComposeViewport(targetId="ComposeTarget")
Compose->>HTML: mount UI into div#ComposeTarget
Note over Compose,HTML: Rendering targets a div-based viewport instead of a canvas
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@gradle.properties`:
- Around line 10-11: The gradle.properties flags android.builtInKotlin=false and
android.newDsl=false are temporary opt-outs that block AGP 9+ built-in Kotlin
and the new Android DSL; update the build to remove these opt-outs by enabling
built-in Kotlin and the new DSL (remove or set android.builtInKotlin=true and
android.newDsl=true), then migrate build logic that relies on legacy behavior:
remove uses of the org.jetbrains.kotlin.android /
org.jetbrains.kotlin.multiplatform mixing (stop applying
org.jetbrains.kotlin.android where it conflicts) and refactor any plugins or
build scripts that reference legacy variant APIs (e.g.,
android.applicationVariants) to use the new DSL/APIs or update those plugins to
versions that support the new DSL.
In `@gradle/wrapper/gradle-wrapper.properties`:
- Line 3: The gradle-wrapper currently points to Gradle 9.3.0 (distributionUrl)
which is compatible with AGP 9.0.0 but your project may still use third‑party
plugins or the removed variant API; update any Gradle plugins, custom buildSrc
or build logic, and plugin versions to AGP 9.0‑compatible releases, replace
usages of the old variant API with the new Gradle DSL/APIs, and run a full build
to fix deprecation/breaking changes (search for distributionUrl, buildSrc, and
any usage of "variant" APIs or old DSL entries to locate affected code). Ensure
you bump plugin versions in build.gradle.* and test CI to confirm no runtime
build breaks.
In `@sample/src/wasmJsMain/resources/index.html`:
- Around line 4-6: Add the missing viewport meta tag to the HTML head to ensure
proper mobile scaling; specifically, update the head section in index.html
(where <meta charset="UTF-8"> and <title>Compose Sonner Demo</title> are
defined) to include <meta name="viewport" content="width=device-width,
initial-scale=1.0"/> so mobile browsers render and scale the page correctly.
In `@sonner/build.gradle.kts`:
- Around line 30-33: The JS module name has a typo: update the string passed to
outputModuleName.set inside the js(IR) { compilerOptions { ... } } block from
"compose-sooner-jscanvas" to the correct "compose-sonner-jscanvas" so the module
name matches the Sonner project naming.
- Around line 14-17: The Gradle config sets the Wasm JS output module name with
a typo: update the wasmJs -> compilerOptions -> outputModuleName.set invocation
to use the correct module name "compose-sonner" instead of "compose-sooner"
(i.e., change the string passed to outputModuleName.set in the
wasmJs.compilerOptions block).
🧹 Nitpick comments (4)
sample/src/commonMain/kotlin/com/dokar/sonner/sample/SampleScreen.kt (1)
49-49: Unused state variabletitleHeight.The
titleHeightstate is declared but never used after the layout refactoring. This creates unnecessary state overhead.Proposed fix
var sampleType by remember { mutableStateOf(SampleType.Basic) } - - var titleHeight by remember { mutableIntStateOf(0) }gradle/libs.versions.toml (1)
19-19: Inconsistent versioning forcompose-material3.This library uses a hardcoded version
"1.9.0"while all other Compose libraries reference"compose-plugin". This could lead to version mismatches and compatibility issues.Suggested fix
-compose-material3 = { module = "org.jetbrains.compose.material3:material3", version = "1.9.0" } +compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "compose-plugin" }sonner/build.gradle.kts (1)
2-2: Unused import.
KotlinNativeTargetis imported but never used in this file.Suggested fix
import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetsample/build.gradle.kts (1)
37-45: Consider addingtargetSdkto the Android library configuration.The
androidLibraryblock specifiescompileSdkandminSdkbut omitstargetSdk. WhiletargetSdkmay be optional for libraries, explicitly setting it ensures consistent behavior across the project.Suggested fix
androidLibrary { namespace = "com.dokar.sonner.sample" compileSdk = libs.versions.android.compileSdk.get().toInt() minSdk = libs.versions.android.minSdk.get().toInt() + targetSdk = libs.versions.android.targetSdk.get().toInt() compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } }
| android.builtInKotlin=false | ||
| android.newDsl=false |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
AGP 9.0 android.builtInKotlin android.newDsl flags requirements
💡 Result:
Short summary — AGP 9.0 changes and required flags/migration
-
Default flags in AGP 9.0: android.newDsl = true and android.builtInKotlin = true (both enabled by default). You can opt out by setting them in gradle.properties: android.newDsl=false and/or android.builtInKotlin=false. [1][2]
-
Built-in Kotlin requirements/behavior:
- AGP 9.0 has a runtime dependency on Kotlin Gradle Plugin (KGP) 2.2.10 and will upgrade lower KGP/KSP versions automatically to the matching versions. [1]
- With built-in Kotlin you must remove applying org.jetbrains.kotlin.android (kotlin-android); migrate kapt, kotlinOptions, kotlin.sourceSets as documented. Module-by-module opt-in/out is possible via android.builtInKotlin. Using org.jetbrains.kotlin.multiplatform with com.android.* is disallowed when built-in Kotlin is enabled. [2]
-
New DSL effects and compatibility:
- android.newDsl switches to the new DSL and removes legacy variant APIs (e.g., android.applicationVariants); some plugins/build logic must be updated. If you need older behavior temporarily, set android.newDsl=false while you migrate. [1]
- android.enableLegacyVariantApi is deprecated/removed in AGP 9.x — use android.newDsl instead. [4]
-
Migration advice and gotchas:
- If you can’t migrate immediately, opt out via gradle.properties (android.builtInKotlin=false and android.newDsl=false) but expect that opt-out will not be supported indefinitely (AGP 10+). Migrate by removing kotlin-android, updating kapt and kotlin DSL usages, and fixing plugins that rely on legacy variant APIs. [2][3]
Sources:
[1] Android Gradle plugin 9.0 release notes — Android Developers.
[2] Migrate to built-in Kotlin — Android Developers.
[3] Kotlin / JetBrains blog post on updating projects for AGP 9.0.
android.builtInKotlin=false is necessary for Kotlin Multiplatform compatibility; android.newDsl=false requires migration planning.
In AGP 9.0, both flags default to true. Setting android.builtInKotlin=false is necessary here because AGP 9.0 explicitly disallows mixing org.jetbrains.kotlin.multiplatform with com.android.* when built-in Kotlin is enabled.
The android.newDsl=false flag temporarily opts out of the new DSL to avoid breaking legacy variant APIs and plugins, but this opt-out will not be supported in AGP 10+. Plan to migrate away from these opt-outs by:
- Removing
org.jetbrains.kotlin.androidplugin application - Updating any plugins or build logic that depend on legacy variant APIs (e.g.,
android.applicationVariants)
🤖 Prompt for AI Agents
In `@gradle.properties` around lines 10 - 11, The gradle.properties flags
android.builtInKotlin=false and android.newDsl=false are temporary opt-outs that
block AGP 9+ built-in Kotlin and the new Android DSL; update the build to remove
these opt-outs by enabling built-in Kotlin and the new DSL (remove or set
android.builtInKotlin=true and android.newDsl=true), then migrate build logic
that relies on legacy behavior: remove uses of the org.jetbrains.kotlin.android
/ org.jetbrains.kotlin.multiplatform mixing (stop applying
org.jetbrains.kotlin.android where it conflicts) and refactor any plugins or
build scripts that reference legacy variant APIs (e.g.,
android.applicationVariants) to use the new DSL/APIs or update those plugins to
versions that support the new DSL.
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check if Gradle 9.3.0 distribution exists
curl -sI "https://services.gradle.org/distributions/gradle-9.3.0-bin.zip" | head -n 1Repository: dokar3/compose-sonner
Length of output: 186
🌐 Web query:
Gradle 9.3.0 release compatibility Android Gradle Plugin 9.0.0
💡 Result:
Yes — AGP 9.0 requires Gradle 9.1.0 minimum, so Gradle 9.3.0 (newer) is compatible. [1][2]
Sources:
- Android Gradle Plugin compatibility table (AGP 9.0 → minimum Gradle 9.1.0). [1]
- Gradle 9.3.0 release notes. [2]
🌐 Web query:
Gradle 9.3 breaking changes compatibility AGP requirements
💡 Result:
Short answer
- Gradle 9.3 is a Gradle 9.x release — Android Gradle Plugin (AGP) support follows the rule that each AGP major release requires a matching (or newer) Gradle major series. To use Gradle 9.3 with Android projects you need AGP 9.x (AGP 9.0+; AGP 9.0 lists Gradle 9.1.0 as its minimum). If your project is still on AGP 8.x, keep Gradle in the 8.x line (AGP 8.13 requires Gradle 8.13). [1][2]
What to watch for (compatibility / breaking effects)
- AGP 9.0 introduced many source/API/DSL changes (new DSL interfaces, removal of the old variant API, built‑in Kotlin, changed defaults and removed Gradle properties). Plugins or custom build logic that target AGP 8.x or older may fail under AGP 9.x (and therefore under Gradle 9.x) until updated. If you upgrade Gradle to 9.3, ensure every third‑party Gradle/AGP plugin you use supports AGP 9.x. [1]
- If you cannot upgrade AGP, do not upgrade Gradle past the maximum supported Gradle version for your AGP (e.g., stay on Gradle 8.x for AGP 8.x). The AGP release notes and compatibility table are the authoritative source for the exact Gradle version requirements. [2]
Recommendations
- If you want Gradle 9.3: first upgrade to AGP 9.0+ (follow the AGP 9.0 migration guide and run the AGP Upgrade Assistant). Test custom plugins/build logic for the new DSL and built‑in Kotlin changes. [1]
- If you must remain on AGP 8.x: stay on the supported Gradle 8.x release (do not move to Gradle 9.3). [2]
Sources
- AGP 9.0 release notes (compatibility, minimum Gradle 9.1.0 and DSL/behavior changes). [1]
- Android Gradle plugin / Android Studio compatibility table (shows AGP 8.13 ↔ Gradle 8.13 and general AGP↔Gradle mapping). [2]
Would you like a checklist for upgrading (steps, gradle.properties flags to set, and common plugin checks)?
Gradle 9.3.0 is compatible with AGP 9.0.0 (exceeds the minimum 9.1.0 requirement). However, ensure third-party Gradle plugins and custom build logic are updated for AGP 9.0's breaking changes, including DSL updates and removal of the old variant API.
🤖 Prompt for AI Agents
In `@gradle/wrapper/gradle-wrapper.properties` at line 3, The gradle-wrapper
currently points to Gradle 9.3.0 (distributionUrl) which is compatible with AGP
9.0.0 but your project may still use third‑party plugins or the removed variant
API; update any Gradle plugins, custom buildSrc or build logic, and plugin
versions to AGP 9.0‑compatible releases, replace usages of the old variant API
with the new Gradle DSL/APIs, and run a full build to fix deprecation/breaking
changes (search for distributionUrl, buildSrc, and any usage of "variant" APIs
or old DSL entries to locate affected code). Ensure you bump plugin versions in
build.gradle.* and test CI to confirm no runtime build breaks.
Summary by CodeRabbit
New Features
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.