Skip to content

Migrate to AGP 9#143

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/update-and-migrate-to-agp-9
Draft

Migrate to AGP 9#143
Copilot wants to merge 4 commits intomainfrom
copilot/update-and-migrate-to-agp-9

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

AGP 9 makes com.android.application and com.android.library incompatible with kotlin.multiplatform in the same module.

Version update

  • AGP 8.13.29.1.1 in buildSrc/build.gradle.kts

Library modules (Path A)

  • Convention plugin: com.android.librarycom.android.kotlin.multiplatform.library
  • androidTarget {} + top-level android {}kotlin { android { namespace; compileSdk } }
  • Removed publishLibraryVariants (single-variant model in new plugin)
  • Unique namespaces per module derived from project path (AGP 9 enforces android.uniquePackageNames=true)

Demo module (Path B)

  • Split Android entry point into new demo-android-app module with pure com.android.application
  • Demo module converted from com.android.application to com.android.kotlin.multiplatform.library
  • Moved MainActivity, AndroidManifest.xml, resources to demo-android-app/

Source set hierarchy workaround

withAndroidTarget() in applyDefaultHierarchyTemplate doesn't recognize the Android target created by com.android.kotlin.multiplatform.library. Added explicit dependsOn:

// In lib-conventions-without-publishing.gradle.kts and demo/build.gradle.kts
sourceSets.androidMain {
    dependsOn(sourceSets.getByName("composeUiMain"))
}

Both publishToMavenLocal and check (including apiCheck) pass.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • add-skill.vercel.sh
    • Triggering command: /usr/local/bin/node node /home/REDACTED/.npm/_npx/ac0ed6aa23b37c1e/node_modules/.bin/skills add REDACTED --skill kotlin-tooling-agp9-migration (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 29, 2026 that may be closed by this pull request
Copilot AI and others added 3 commits April 29, 2026 09:27
…atform.library for KMP modules, split demo Android app

Agent-Logs-Url: https://github.com/huanshankeji/compose-multiplatform-html-unified/sessions/6fc1ab56-9962-4a2c-abb3-fd488d489df4

Co-authored-by: ShreckYe <27768951+ShreckYe@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

Copilot AI changed the title [WIP] Update and migrate project to AGP 9 Migrate to AGP 9 Apr 29, 2026
Copilot AI requested a review from ShreckYe April 29, 2026 09:58
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.

Update and migrate to AGP 9

2 participants