https://kotlinlang.org logo
Title
x

xxfast

05/08/2023, 3:12 AM
Hi all. I'm trying to setup the new Android source set layout and running into a problem getting
debugImplementation
mapped correctly. I'm following this guide to setup compose for testing, according to which I need
// Needed for createAndroidComposeRule, but not createComposeRule:
debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version")
Following the multiplatform guide for android flavours, I configured it as
@OptIn(ExperimentalKotlinGradlePluginApi::class)
sourceSets.invokeWhenCreated("androidDebug") {
  dependencies {
    implementation(libs.compose.ui.test.manifest)
  }
}
However this doesn't seem to work 🤔. Anyone attempted to configure this? More in the thread 🧵
You can find a reproducer here, basically I have two sets of tests 1. Tests without an activity ( working as intended) 2. Tests with an activity ( failing with a generic error)
java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=io.github.xxfast.decompose.router.test/io.github.xxfast.decompose.TestActivity }
at androidx.test.core.app.InstrumentationActivityInvoker.startActivity(InstrumentationActivityInvoker.java:399)
at androidx.test.core.app.InstrumentationActivityInvoker.startActivity(InstrumentationActivityInvoker.java:422)
according to this message, this is due to how the manifest dependency is configured. Am I missing something in the configuration?
Welp, this is embarrassing - I managed to solve the issue by moving my activity out to
AndroidMain
, and apparently you can't have an activity defined just in
androidInstrumentedTest
(dont see a straightforward way to do this). Eitherway this is not multiplatform issue so i'll take this thread elsewhere