Category "kotlin"

How to get the current index in for each Kotlin

How to get the index in a for each loop? I want to print numbers for every second iteration For example for (value in collection) { if (iteration_no % 2) {

How to get the current index in for each Kotlin

How to get the index in a for each loop? I want to print numbers for every second iteration For example for (value in collection) { if (iteration_no % 2) {

Compose preview doesn't work at all - project needs to be compiled

I use Android Studio Bumblebee 2021.1.1 Patch 3 built on March 16, 2022 androidx.compose.ui:ui-tooling, androidx.compose.ui:ui-tooling-preview, androidx.compose

Flutter: Execution failed for task ':location:compileDebugKotlin'

Execution failed for task ':location:compileDebugKotlin'. build:gradle(Module:app) ext.kotlin_version = '1.6.10' repositories { maven {

Kotlin Test Coverage

Does anyone know if a good test coverage tool (preferably Gradle plugin) exists for Kotlin? I've looked into JaCoCo a bit, but it doesn't seem to reliably suppo

Compose Desktop testing - how to check if something is visible?

Given some simple content: @Composable fun MyContent() { var showThing by remember { mutableStateOf(false) } if (showThing) { Box(Modifier.testT

Kotlin code coverage in CI pipeline

Interested to find code coverage tools for kotlin that work well in a CI pipeline. use intellij built in code coverage but cant use this in CI. Thanks

How to iterate over hashmap in Kotlin?

How to iterate over HashMap in Kotlin? typealias HashMap<K, V> = HashMap<K, V> (source)

Cannot create instance of viewmodel after using Hilt in Android

Here is my AllFilesListViewModel class. class AllFilesListViewModel @ViewModelInject constructor( private val pdfItemRepository: PdfItemRepository):ViewMod

Cannot create instance of viewmodel after using Hilt in Android

Here is my AllFilesListViewModel class. class AllFilesListViewModel @ViewModelInject constructor( private val pdfItemRepository: PdfItemRepository):ViewMod

Gradle can not find firebase auth ktx library in android

As you can see below, I have encounter this error when I try to download missing files inside firebase auth.ktx library otherwise I can not reach any document

Firebase recyclerview always refreshes and losses its scroll position when starting new activity and returning

My Firebase recycler view always refreshes and loses its scroll position when opening new activity and coming back. Tried multiple solution in Stack Overflow bu

My observer is always firing when I come back from one fragment to another

I'm using Navigation Components, I have Fragment A and Fragment B, from Fragment A I send an object to Fragment B with safe args and navigate to it. override f

java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext Android

I've been getting an error like this for days, but I couldn't find a solution. Can you please help me? What could the problem be caused by? Error : java.lang.Il

In which situation val/var is necessary in Kotlin constructor parameter?

Right code: class MainActHandler(val weakActivity: WeakReference<Activity>): Handler() { override fun handleMessage(msg: Message?) { val true

Android studio code coverage not showing any Kotlin classes

I have 2 Kotlin based AS projects. One works fine, the other doesn't. Both have an identical structure and gradle config. I'm using Kotlin 1.1.4-2 with AS 3.0b2

How to avoid partial coverage with lateinit fields in Kotlin

I have an Android service written in Kotlin which I inject using Guice. It has lateinit fields which cannot be null, but they must be lateinit because I cannot

JaCoCo returning 0% Coverage with Kotlin and Android 3.0

I am trying to check my code coverage for a test case that I wrote in Kotlin. When I execute ./gradlew createDebugCoverageReport --info, my coverage.ec file is

Kotlin + Java 9 modules (Java 11 in use) + maven

I've created a simple project with Java and Kotlin code, and I'm trying to compile it as Java 9 module. Here is my pom.xml: <?xml version="1.0" encoding="UT

Invoke Operator & Operator Overloading in Kotlin

I get to know about the Invoke operator that, a() is equivalent to a.invoke() Is there anything more regarding Invoke operator than please explain. Also, I did