Hi. I have added moko resources library to the pro...
# moko
g
Hi. I have added moko resources library to the project but for some reason it does not generate MR class
It is a new project with barely anything. this is root Gradle file
Copy code
import dev.icerock.gradle.MRVisibility

plugins {
  kotlin("multiplatform") version "1.9.23"
  id("dev.icerock.mobile.multiplatform-resources") version "0.24.0-beta-4"
}

multiplatformResources {
  resourcesPackage = "io.github.shalva97"
  resourcesVisibility = MRVisibility.Internal
}

repositories { mavenCentral() }

kotlin {
  jvmToolchain(17)
  jvm()
  macosX64()
//  linuxX64()
}

dependencies {
  commonMainApi("dev.icerock.moko:resources:0.24.0-beta-4")
  commonTestImplementation("dev.icerock.moko:resources-test:0.24.0-beta-4")
}
buildscript {
  dependencies {
    classpath("dev.icerock.moko:resources-generator:0.24.0-beta-4")
  }
}
and this is the project structure
Any ideas? I have tried to run samples, which are in the repository and it works there. Now here I am can not even add it to an empty project
g
i've faced sth similiar when i had :
Copy code
e: file:///Users/.../shared/localization/build/generated/moko-resources/commonMain/src/com/example/app/SharedRes.kt:9:22 Expected object 'SharedRes' has no actual declaration in module <project.shared:localization> for Native
so the reason was:
Copy code
-using:
kotlin {
   android()
   ios()
   sourceSets {
        named("commonMain") { ... }
        named("iosMain") { .... }
   }
}
-instead of:
kotlin {
   androidTarget()
   iosArm64() // or iosX64()
   // iosSimulatorArm64("ios") // add simulator target if needed
   sourceSets {
        commonMain { ... }
        commonMain { .... }
   }
}
so basically stopped using deprecated things(targets renamed, and named modules) and it worked: gradle ver.:gradle-8.4 koltin: 1.9.23
@Giorgi also this is invalid:
Copy code
multiplatformResources {
  resourcesPackage = "io.github.shalva97"
  resourcesVisibility = MRVisibility.Internal
}
it should be
resourcesPackage.set("io.github.shalva97")
and same for all other params
📌 1
g
I think it does not work because I do not have android() or ios()
I just have jvm() and native target
g
anyway starting from
0.24.0-alpha-1
multiplatformResources
requires using
.set(...)
instead of
=
. see release notes
👍 1
d
Please run
./gradlew generateMRCommonMain
and provide the error or stacktrace
106 Views