Skip to content

Last version Not Work build error #850

@kecoli2

Description

@kecoli2

Here’s a clear, professional GitHub issue draft you can open on icerockdev/moko-resources.
It summarizes your exact setup, Gradle versions, and the problems you’re facing.


🐛 Bug: Gradle 8.13 + Kotlin 2.2.20 + AGP 8.13.0 cause task and configuration errors with moko-resources 0.25.1

Environment

Component | Version -- | -- moko-resources | 0.25.1 Kotlin | 2.2.20 Gradle | 8.13 Android Gradle Plugin (AGP) | 8.13.0 Compose Multiplatform | 1.9.0 Kotlin Multiplatform Plugin | org.jetbrains.kotlin.multiplatform Project type | Kotlin Multiplatform (Android + iOS + JVM) Module affected | core (shared module with com.test.core package) OS | Windows 11

Problem Description

When using dev.icerock.mobile.multiplatform-resources plugin inside a Kotlin Multiplatform module that has Android + iOS + JVM targets,
Gradle 8.13 produces several task dependency and Android resource merge errors.

Even after adding explicit afterEvaluate { dependsOn(...) } and sourceSets configurations, the following problems remain.


1️⃣ Implicit dependency / validation errors

A problem was found with the configuration of task ':core:generateMRandroidMain' Gradle detected a problem with the following location: 'C:\KMP\core\build\generated\moko-resources\androidMain\res'

Reason: Task ':core:packageAndroidMainResources' uses this output of
task
':core:generateMRandroidMain' without declaring an explicit dependency.

Also occurs for:

  • :core:generateMRandroidDeviceTest

  • :core:processAndroidDeviceTestNavigationResources

  • :core:generateAndroidDeviceTestResources

This breaks builds in Gradle 8.13 (due to stricter validation of implicit task dependencies).


2️⃣ .properties resource file issue (Android merge fails)

When the plugin generates .properties bundles, Android resource merge fails with:

ERROR: .../build/generated/moko-resources/androidMain/res/localization/comtestcore_mokoBundle.properties: Resource and asset merger: The file name must end with .xml

Android’s aapt expects only .xml files under res/, so this prevents packaging.


3️⃣ Deprecated Kotlin DSL warning when trying to fix sourceSets manually

If sourceSets is configured inside kotlin.androidLibrary { ... } block, Gradle emits:

'val sourceSets: NamedDomainObjectContainer<KotlinSourceSet>' is deprecated. Accessing 'sourceSets' container on the Kotlin target level DSL is deprecated. Consider configuring 'sourceSets' on the Kotlin extension level. This API is scheduled for removal in Kotlin 2.3.

Expected Behavior

The plugin should:

  • Generate Android XML resource files (no .properties) under build/generated/moko-resources/androidMain/res.

  • Properly register task dependencies between generateMR* and Android resource packaging tasks.

  • Work without manual afterEvaluate or deprecated sourceSets configuration.

  • Be compatible with Gradle 8.13 + Kotlin 2.2.20 + AGP 8.13.0.


Steps to Reproduce

  1. Use this minimal configuration:

    plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidLibrary) alias(libs.plugins.moko.resources) }

    kotlin {
    androidLibrary {
    namespace = "com.test.core"
    }
    iosX64(); iosArm64(); iosSimulatorArm64()
    jvm()
    }

    multiplatformResources {
    resourcesPackage.set("com.test.core")
    }

  2. Add a core/src/commonMain/moko-resources/base/strings.xml.

  3. Run:

    ./gradlew :core:assemble
  4. Observe task-dependency and resource-merge errors.


Additional Notes / Suggestions

  • Perhaps the plugin should generate Android XML localizations instead of .properties for Android targets.

  • Gradle 8.13 tightened validation for implicit task dependencies; explicit dependsOn may need to be added inside the plugin itself.

  • Access to sourceSets inside Kotlin target DSL is now deprecated; plugin may need to register generated directories through AGP’s new APIs.

Here’s a clear, professional GitHub issue draft you can open on [icerockdev/moko-resources](https://github.com/icerockdev/moko-resources?utm_source=chatgpt.com) . It summarizes your exact setup, Gradle versions, and the problems you’re facing.

🐛 Bug: Gradle 8.13 + Kotlin 2.2.20 + AGP 8.13.0 cause task and configuration errors with moko-resources 0.25.1
Environment
Component Version
moko-resources 0.25.1
Kotlin 2.2.20
Gradle 8.13
Android Gradle Plugin (AGP) 8.13.0
Compose Multiplatform 1.9.0
Kotlin Multiplatform Plugin org.jetbrains.kotlin.multiplatform
Project type Kotlin Multiplatform (Android + iOS + JVM)
Module affected core (shared module with com.test.core package)
OS Windows 11
Problem Description

When using dev.icerock.mobile.multiplatform-resources plugin inside a Kotlin Multiplatform module that has Android + iOS + JVM targets,
Gradle 8.13 produces several task dependency and Android resource merge errors.

Even after adding explicit afterEvaluate { dependsOn(...) } and sourceSets configurations, the following problems remain.

1️⃣ Implicit dependency / validation errors
A problem was found with the configuration of task ':core:generateMRandroidMain'
Gradle detected a problem with the following location:
'C:\KMPTest\core\build\generated\moko-resources\androidMain\res'

Reason: Task ':core:packageAndroidMainResources' uses this output of
task ':core:generateMRandroidMain' without declaring an explicit dependency.

Also occurs for:

:core:generateMRandroidDeviceTest

:core:processAndroidDeviceTestNavigationResources

:core:generateAndroidDeviceTestResources

This breaks builds in Gradle 8.13 (due to stricter validation of implicit task dependencies).

2️⃣ .properties resource file issue (Android merge fails)

When the plugin generates .properties bundles, Android resource merge fails with:

ERROR: .../build/generated/moko-resources/androidMain/res/localization/comtestcore_mokoBundle.properties:
Resource and asset merger: The file name must end with .xml

Android’s aapt expects only .xml files under res/, so this prevents packaging.

3️⃣ Deprecated Kotlin DSL warning when trying to fix sourceSets manually

If sourceSets is configured inside kotlin.androidLibrary { ... } block, Gradle emits:

'val sourceSets: NamedDomainObjectContainer' is deprecated.
Accessing 'sourceSets' container on the Kotlin target level DSL is deprecated.
Consider configuring 'sourceSets' on the Kotlin extension level.
This API is scheduled for removal in Kotlin 2.3.

Expected Behavior

The plugin should:

Generate Android XML resource files (no .properties) under build/generated/moko-resources/androidMain/res.

Properly register task dependencies between generateMR* and Android resource packaging tasks.

Work without manual afterEvaluate or deprecated sourceSets configuration.

Be compatible with Gradle 8.13 + Kotlin 2.2.20 + AGP 8.13.0.

Steps to Reproduce

Use this minimal configuration:

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.moko.resources)
}

kotlin {
androidLibrary {
namespace = "com.test.core"
}
iosX64(); iosArm64(); iosSimulatorArm64()
jvm()
}

multiplatformResources {
resourcesPackage.set("com.test.core")
}

Add a core/src/commonMain/moko-resources/base/strings.xml.

Run:

./gradlew :core:assemble

Observe task-dependency and resource-merge errors.

Additional Notes / Suggestions

Perhaps the plugin should generate Android XML localizations instead of .properties for Android targets.

Gradle 8.13 tightened validation for implicit task dependencies; explicit dependsOn may need to be added inside the plugin itself.

Access to sourceSets inside Kotlin target DSL is now deprecated; plugin may need to register generated directories through AGP’s new APIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions