Comments (5)
CMP plugin is responsible for the resource merging on iOS
yes 👍
Android works because the resources are packed into aar libraries and there is no an additional logic
from compose-multiplatform.
@chrisbanes could you provide a small reproducer? I couldn't reproduce:
run ./gradlew :composeApp:iosSimulatorArm64Test
IosTestCheck.zip
from compose-multiplatform.
@OptIn(ExperimentalTestApi::class)
class ComposeTest {
@OptIn(ExperimentalResourceApi::class)
@Test
fun simpleCheck() = runComposeUiTest {
var bytes = ByteArray(0)
setContent {
val env = rememberResourceEnvironment()
LaunchedEffect(true) {
bytes = getDrawableResourceBytes(env, Res.drawable.ic_cyclone)
}
val resText = stringResource(Res.string.open_github)
var txt by remember { mutableStateOf(resText) }
Column {
Text(
text = txt,
modifier = Modifier.testTag("t_text")
)
Button(
onClick = { txt += "." },
modifier = Modifier.testTag("t_button")
) {
Text("click me")
}
}
}
waitForIdle()
assertEquals(943, bytes.size)
onNodeWithTag("t_button").apply {
repeat(3) { performClick() }
}
onNodeWithTag("t_text").assertTextEquals("Open github...")
}
}
from compose-multiplatform.
Hmmm, I can repro this locally but I haven't tried making a reproducer yet. Here's the error:
org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: /foo/bar/shared/core/data/content/build/bin/iosSimulatorArm64/debugTest/compose-resources/composeResources/com.foo.bar/values/generated.commonMain.cvr
at <global>.Data,(/opt/buildAgent/work/b2e1db4d8d903ca4/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:28)
at <global>.Data,(/opt/buildAgent/work/b2e1db4d8d903ca4/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:23)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt:5)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt:32)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt:17)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt:27)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResourcesUtils.kt:30)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResourcesUtils.kt:29)
at <global>.Data,(/opt/buildAgent/work/3eb902016bd3838/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResourcesUtils.kt:27)
If I look in the build/bin/iosSimulatorArm64/debugTest
folder, there is no compose-resources
. The resources are from a different module which we depend on, so might be related to that. I'll keep digging.
from compose-multiplatform.
ugh just worked this out. The modules with failing tests did not have the CMP plugin applied on it 🤦.
Weirdly the Android unit tests worked as expected, but I assume the CMP plugin is responsible for the resource merging on iOS?
from compose-multiplatform.
Related Issues (20)
- iOS App crashes on launch with MissingResourceException HOT 1
- Keyboard not opening in iOS When using ExposedDropdownMenu HOT 2
- ImageViewer/Desktop - Build error due to a code not updated after some refactoring
- Enahancement: Background Image Modifier with Alignment and Repeat Options HOT 1
- How to complete the check for updates and automatic updates HOT 3
- The release package failed on Android HOT 7
- Overriding string resources causes crashes or inelligible strings HOT 1
- Plural string not working properly HOT 4
- Is there any consideration for supporting the HarmonyOS? Or adding some public interfaces to adapt to other systems? HOT 1
- LazyVerticalStaggeredGrid rearranges items when scrolling up
- [iOS] voice dictation text does not register with text fields using TextFieldValue HOT 1
- [Compose Web]: TypeError: content is not a function HOT 7
- Support for "Plus Darker" and "Plus Lighter" blend modes HOT 1
- Update Lifecycle Runtime Compose to 2.8.2 HOT 3
- Need some help with debugging the compose multiplatform core code
- IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
- Exception in thread "main" java.lang.NoSuchMethodError: 'void androidx.compose.ui.graphics.SkiaBackedCanvas_skikoKt.setAlphaMultiplier(androidx.compose.ui.graphics.Canvas, float)' HOT 2
- Multi language string resources can't be decoded in 1.7.0 HOT 2
- need help with compiling CM-core code HOT 2
- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot read field "x" because "rc" is null HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose-multiplatform.