so I've got a common compose module shared by desk...
# compose-desktop
a
so I've got a common compose module shared by desktop and android, and I'm running into an issue where I need some icon resources to load into views. Is there an accepted way to share these resources in a module that is common to both desktop and android? Android wants an R references of course, and desktop wants a resource path.
l
a
Oh tricky! Thanks!
l
I’m sure we’ll get a built-in solution at some point in the future (hopefully when #compose-ios is ready), but the workaround in the issue should work for now.
Note that the workaround uses reflection on Android, so it could run much slower.
a
huh, so this is a weird one, I added that resource directory to the android definition, and it lost it's mind about which directory is a module or not. A has the new resource directory, B does not.
A)
Copy code
android {
    compileSdk = android_compile_sdk.toInt()
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/resources")
    defaultConfig {
        minSdk = android_min_sdk.toInt()
        targetSdk = android_target_sdk.toInt()
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}
B)
Copy code
android {
    compileSdk = android_compile_sdk.toInt()
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdk = android_min_sdk.toInt()
        targetSdk = android_target_sdk.toInt()
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}
that one line is the only difference