android / kotlin-multiplatform-samples

Samples showcasing the experimental Kotlin Multiplatform Jetpack libraries
https://androidx.github.io/kmp-eap-docs/
Apache License 2.0
915 stars 81 forks source link

Unable to compile DiceRoller #24

Closed cmota closed 2 weeks ago

cmota commented 3 months ago

I'm unable to compile the DiceRoller project with the latest version of Android Studio (Koala 2024.1.2. Canary 3).

The error that I'm getting is:

Collection contains no element matching the predicate.

Which after checking the IDE logs is related to:

java.util.NoSuchElementException: Collection contains no element matching the predicate.
    at org.jetbrains.kotlin.android.models.KotlinModelConverter.convert(KotlinModelConverter.kt:626)
    at org.jetbrains.kotlin.android.models.KotlinModelConverter.createGradleAndroidModelData(KotlinModelConverter.kt:448)
    at org.jetbrains.kotlin.android.extensions.KotlinMppAndroidProjectResolverExtension.createAndAttachModelsToDataNode(KotlinMppAndroidProjectResolverExtension.kt:312)
    at org.jetbrains.kotlin.android.extensions.KotlinMppAndroidProjectResolverExtension.afterResolveFinished(KotlinMppAndroidProjectResolverExtension.kt:230)
    at org.jetbrains.kotlin.idea.gradleJava.configuration.mpp.CompositeKotlinMppGradleProjectResolverExtension.afterResolveFinished(KotlinMppGradleProjectResolverExtension+buildInstance.kt:78)
    at org.jetbrains.kotlin.idea.gradleJava.configuration.KotlinMppGradleProjectResolver.resolveFinished(KotlinMppGradleProjectResolver.kt:124)

To fix this issue, we need to update the agp plugin to version 8.4.1.

cartland commented 3 weeks ago

I just updated the Fruitties project to the latest agp in https://github.com/android/kotlin-multiplatform-samples/pull/28.

I'm curious, are there any specific features in DiceRoller that you think are important for understanding Kotlin Multiplatform? The team created Fruitties as a simple UI that could easily demonstrate a few more libraries. If Fruitties is able to show all of the KMP features used by DiceRoller, it might be easier to focus maintenance efforts on a single app. I'm trying to understand what we might lose from removing DiceRoller and focusing on Fruitties.

cartland commented 2 weeks ago

This should be fixed now. Tested on Android Studio Koala 2024.1.1 Patch 2.