moko-resources
moko-resources copied to clipboard
Expected object 'MR' has no actual declaration in module <kamel-samples_debug> for JVM
I tried updating moko-rosources from 20.1
to 22.0
in my fork of kamel
, and I can't get android to build with the 22.0
moko-resources, all other targets are building fine.
The error I'm getting is Expected object 'MR' has no actual declaration in module <kamel-samples_debug> for JVM
https://github.com/luca992/Kamel/tree/moko22
I am using
kotlin.mpp.androidSourceSetLayoutVersion=2
if that matters
as i see we should enable moko-resources
gradle plugin after AGP plugin to AGP correctly read generated source set
https://github.com/luca992/Kamel/pull/1
I'm experiencing the same issue. And I have no JVM target either.
Moving plugin declarations around as suggested makes no difference.
Task :frontend:modules:common:compileDebugKotlinAndroid
fails with the following error:
Expected object 'commonR' has no actual declaration in module <common_debug> for JVM
But androidMain/*/commonR.kt
, androidMain/*/res/*.xml
and commonMain/*/commonR.kt
are generated correctly.
Here are some examples of my configuration
:frontend:modules:common:build.gradle.kts
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.moko.resources)
}
multiplatformResources {
multiplatformResourcesPackage = "some.package.name.common"
multiplatformResourcesClassName = "commonR"
}
kotlin {
android { compilations.all { kotlinOptions { jvmTarget = "1.8" } } }
iosX64()
iosArm64()
iosSimulatorArm64()
js(IR) { browser() }
sourceSets {
val commonMain by getting {
dependencies {
api(libs.moko.resources)
// ...
}
}
}
// ...
}
:build.gradle.kts
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.cocoapods) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.moko.resources) apply false
}
versions.toml
kotlin = "1.9.0-Beta" # 1.8.21 makes no difference
android-application = "com.android.application:7.4.0"
android-library = "com.android.library:7.4.0"
moko-resources = "dev.icerock.moko:resources:0.22.3"
Task :frontend:modules:common:compileKotlinJs
also fails with the same error:
Expected object 'commonR' has no actual declaration in module <Project.frontend.modules:common> for JS
@xpathexception you should use AGP 7.4.2 or later
I'm facing the issue, moving moko-resources plugin around does not work. I've upgraded to kotlin 1.9 recently. There is no problem with kotlin 1.8.21.
Same, with kotlin 1.9 MR try to found actual declaration, but with kotlin 1.8.21 project builds successfully
I think I'm facing the same issue. A work-around was to add a dependency to commonMain
to jvmMain
like:
val jvmMain by getting {
dependsOn(commonMain)
}
The works for Kotlin 1.9.10 and Compose 1.5.1.
will be fixed in 0.24.0, please check in 0.24.0-alpha-6
should be fixed in 0.24.0-beta-1