https://kotlinlang.org
Join Slack
I'm trying to upgrade Kotlin to 1.7.0 and I'm no longer able to get my `buildSrc` project to configu...
m

mkrussel

almost 3 years ago
I'm trying to upgrade Kotlin to 1.7.0 and I'm no longer able to get my
buildSrc
project to configure. It's breaking on applying the
kotlin-dsl
plugin.
An exception occurred applying plugin request [id: 'org.gradle.kotlin.kotlin-dsl', version: '2.3.3']
> Failed to apply plugin class 'org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper'.
   > Could not create an instance of type org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension.
      > Companion
Gradle version: 7.3.3 Kotlin version: 1.7.0 kotlin-dsl version: 2.2 and 2.3.3
m
m
+2
  • 4
  • 69
  • 868
When is an Android ViewModel's `init {}` called? I know that LiveData's only get initialized after o...
o

Orhan Tozan

about 5 years ago
When is an Android ViewModel's
init {}
called? I know that LiveData's only get initialized after observing them, but what about the init block? On Activity onCreate?
o
a
+3
  • 5
  • 15
  • 868
Anyone know how to search with a wildcard in Intellij? i.e. I want to find all instances of ```MyS...
c

Colton Idle

over 2 years ago
Anyone know how to search with a wildcard in Intellij? i.e. I want to find all instances of
MySingleton.[THE WILD CARD].copy
in my code
c
p
e
  • 3
  • 2
  • 866
How to deal with a route in `NavHost` that contains polymorphic members … more in :thread:
a

Ahmed

9 months ago
How to deal with a route in
NavHost
that contains polymorphic members … more in 🧵
a
s
  • 2
  • 10
  • 862
Does anyone know how to unit test code which uses `Flow.debounce`? The unit test doesn't wait until ...
m

muthuraj

almost 4 years ago
Does anyone know how to unit test code which uses
Flow.debounce
? The unit test doesn't wait until debounce is completed. It should actually advance the delay since I'm using
runBlockingTest
as per the documentation, but that doesn't happen. Here is an example that reproduces my case.
class DebounceTest(scope: CoroutineScope) {
    private val stateFlow = MutableStateFlow("")
    val resultFlow = MutableStateFlow("")

    init {
        stateFlow.debounce(500)
            .onEach {
                resultFlow.value = it
            }
            .launchIn(scope)
    }

    fun search(text: String){
        stateFlow.value = text
    }
}

@Test
    fun debounceTest() = runBlockingTest {
        val sut = DebounceTest(this)
        sut.search("test")
        assertThat(sut.resultFlow.value).isEqualTo("test")
    }
The test here fails saying the actual value of
resultFlow.value
is empty string instead of
test
m
m
n
  • 3
  • 4
  • 859
Hey I am getting error on my unit test.
v

Vivek Modi

over 3 years ago
Hey I am getting error on my unit test.
v
j
  • 2
  • 3
  • 857
After updating to Compose 1.2 we have a ton of flaky UI tests (end-to-end tests). - `Test instrumen...
j

Jan Skrasek

almost 3 years ago
After updating to Compose 1.2 we have a ton of flaky UI tests (end-to-end tests). •
Test instrumentation process crashed.
app simply stops responding to some focus event and then instrumentation timeouts after 5 seconds, what's more, the interaction is on non-compose view at this particular time. •
java.lang.IllegalStateException: No compose hierarchies found in the app. Possible reasons include ...
suddenly this started happening, but not always - probably tests access activity too early, seems like idling resource issue, but this was not happening at all before update • Compose recomposing forever - timeouting because not able to reach an idle state - this was only issue I was able to fix - we were missing
remember
, but actually without UI test no repeated recomposition was happening there Do you any similar experience, tips where to look for issues/errors/fixes?
😢 1
j
p
  • 2
  • 5
  • 855
Is it possible to zip 3 lists? I am zipping 2 here, but I would like to throw a list of icons into t...
n

Nat Strangerweather

almost 3 years ago
Is it possible to zip 3 lists? I am zipping 2 here, but I would like to throw a list of icons into the mix. How would it work in Kotlin?
@Composable
fun ShowDropDown(
    openDropDown: MutableState<Boolean>,
    text: List<String>,
    destination: List<DirectionDestination>,
    navigator: DestinationsNavigator,
) {
    DropdownMenu(
        expanded = openDropDown.value,
        onDismissRequest = { openDropDown.value = false },
    ) {
        text.zip(destination)
            .forEach {
                DropdownMenuItem(onClick = { navigator.navigate(it.second) },
                text = { Text(it.first) })
            }

    }
}
n
l
m
  • 3
  • 5
  • 855
How to use coroutine's Flow class from scratch.kts file ? (I'm not using gradle in this time)
t

tateisu

over 4 years ago
How to use coroutine's Flow class from scratch.kts file ? (I'm not using gradle in this time)
t
j
a
  • 3
  • 7
  • 854
Hi guys, i’m converting my existing Android app into KMM and i’m having really hard time configuring...
l

Loe

over 2 years ago
Hi guys, i’m converting my existing Android app into KMM and i’m having really hard time configuring gradle. The specific issue i’m hitting now is with adding Firebase Libraries:
val commonMain by getting {
    dependencies {
        // Firebase: Import the BoM for the Firebase platform
        implementation(project.dependencies.platform("com.google.firebase:firebase-bom:31.0.2"))
        // Firebase: Cloud Firestore library BoM doesn't specify versions in Firebase library dependencies
        implementation("com.google.firebase:firebase-firestore-ktx")
        // Firebase: crashlytics
        implementation("com.google.firebase:firebase-crashlytics")

        // Firebase: Authentication
        implementation("com.google.firebase:firebase-auth-ktx")
        // Coroutines support libraries for Kotlin - required by firebase-analytics
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4")

        // TODO this is platform specific?
        //implementation("com.google.firebase:firebase-analytics-ktx")
    }
}
Error:
:shared:iosArm64Main: Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4.
Required by:
    project :shared > com.google.firebase:firebase-firestore-ktx:24.4.0 > com.google.firebase:firebase-common-ktx:20.2.0

Possible solution:
 - Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
l
j
j
  • 3
  • 5
  • 853
Previous505152Next

kotlinlang

A modern programming language that makes developers happier.

Powered by