I've upgraded my Compose Multiplatform (Android + iOS + Desktop) project from `Kotlin 2.1.0-Beta1` t...
a

Armond Avanes

about 1 year ago
I've upgraded my Compose Multiplatform (Android + iOS + Desktop) project from
Kotlin 2.1.0-Beta1
to
Kotlin-2.1.0-Beta2
and now I'm getting the following error when building the app to run on iOS Simulator:
Undefined symbols for architecture arm64:
  "_kfun:androidx.lifecycle.viewmodel.compose#access$<get-androidx_lifecycle_viewmodel_compose_LocalViewModelStoreOwner$stable>$p$tLocalViewModelStoreOwnerKt(){}kotlin.Int", referenced from:
      _kfun:com.test.RouteA#internal in composeApp[2](ComposeApp.framework.o)
      _kfun:com.test.RouteB#internal in composeApp[2](ComposeApp.framework.o)      _kfun:com.test#TestField(com.test.TestViewModel?;androidx.compose.ui.Modifier?;com.test.TestModel?;kotlin.String?;kotlin.Function0<kotlin.Unit>?;kotlin.Function0<kotlin.Unit>?;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){} in composeApp[2](ComposeApp.framework.o)
      _kfun:com.test.RouteC#internal in composeApp[2](ComposeApp.framework.o)
      _kfun:com.test.RouteD#internal in composeApp[2](ComposeApp.framework.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Android and Desktop builds are working fine. I'm using the following related multiplatform frameworks/libraries: • jetbrains compose: "1.7.0-rc01" • jetbrains lifecycle and viewmodel: "2.8.2" • jetbrains navigation compose: "2.8.0-alpha10" • koin: 4.0.0 I'll appreciate if someone can help.
I'm trying to get a SpringBootTest (Spring2.5.4) running after switching to Kotlin (1.7.20). So this...
s

Stephan Schroeder

about 3 years ago
I'm trying to get a SpringBootTest (Spring2.5.4) running after switching to Kotlin (1.7.20). So this is the link with the Java example: https://www.appsdeveloperblog.com/testresttemplate-http-post-example/ This is my code with constructor injection instead of property injection via
@Autowired
.
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class ValidationTest(
    private val restTemplate: TestRestTemplate,
) {
    @LocalServerPort
    private val port = 0

    @Test
    fun greetingShouldReturnDefaultMessage() {
        Assertions.assertThat(restTemplate.getForObject("<http://localhost>:$port/", String::class.java)).contains("405")
    }
...
}
Unfortunatle the constructor injection fails before the test is even entered. No ParameterResolver for TestRestTemplate can be found.
No ParameterResolver registered for parameter [org.springframework.boot.test.web.client.TestRestTemplate restTemplate] in constructor [public de.fhirvalidationserver.ValidationTest(org.springframework.boot.test.web.client.TestRestTemplate)].
 org.junit.jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [org.springframework.boot.test.web.client.TestRestTemplate restTemplate] in constructor [public de.fhirvalidationserver.ValidationTest(org.springframework.boot.test.web.client.TestRestTemplate)].
I assumed SpringBootTest would instanciate an instance of TestRestTemplate for me. Was that the mistake or is something else missing?