https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
android
  • b

    brian

    03/07/2023, 12:25 PM
    Hello everyone I have a question I keep getting errors on the
    build.gradle.kts
    Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler'. Check your module classpath for missing or conflicting dependencies
  • b

    brian

    03/07/2023, 12:26 PM
    This happened after I changed the jdk from 1.8 to 11
    f
    • 2
    • 2
  • a

    Andre Theilacker

    03/07/2023, 4:25 PM
    Hi! Has anyone experienced a bug with JaCoCo reporting 0% coverage on multi module Android projects? Details in thread
    y
    m
    • 3
    • 3
  • c

    chanjungskim

    03/09/2023, 3:51 AM
    How can I solve this problem..?? even though the data changes the values in composable function remains when I use the same composable function consecutively.. https://stackoverflow.com/questions/75680245/how-can-i-give-different-idor-key-for-new-compose-function-but-same-function
    p
    • 2
    • 5
  • a

    anshulnigam111

    03/09/2023, 7:03 AM
    Team i am unable to write baseline for dfm module is there a way around it?
  • n

    Nav

    03/09/2023, 8:16 AM
    Is there anyway to show a scrollbar with a LazyColumn or any other scrollable widget inside Jetpack Compose?
    s
    • 2
    • 2
  • t

    Timur Abdyraev

    03/09/2023, 8:50 AM
    hi there! Im using
    Dokka
    for documenting my Android Application and I want to know how to exclude inherited members from class. `supressInheritedMembers`doesn't work. My Gradle Task:
    tasks.dokkaHtmlMultiModule {
        moduleName.set("")
        moduleVersion.set(appConfig.versionName)
        suppressInheritedMembers.set(true)
    
    
        pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
            separateInheritedMembers = true
            customAssets = listOf(file("assets/tez-sat.svg"))
            footerMessage =
                "Tez Sat™ Technical Documentation © ${java.time.Year.now().value} Copyright."
            customStyleSheets =
                listOf(file("$projectDir/logo-style.css"), file("$projectDir/logo-styles.css"))
        }
    }
    • 1
    • 1
  • k

    Keval Kanpariya

    03/09/2023, 11:49 AM
    Task :app:hiltJavaCompileDebug
    error: ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.SingletonC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
    Dependency trace:
          => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule
    ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.SingletonC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
    => element (METHOD): provideFactory(android.app.Activity,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
          => annotation: @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
          => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
    If type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is on your classpath.
    error: ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.ActivityRetainedC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
    Dependency trace:
          => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule
          => element (METHOD): provideFactory(android.app.Activity,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
    ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.ActivityRetainedC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
    => annotation: @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
          => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
    If type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is on your classpath.
    ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.ActivityC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
    error: ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.ActivityC' because 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' could not be resolved.
    Dependency trace:
          => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.ActivityModule
          => element (METHOD): provideFactory(android.app.Activity,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
          => annotation: @dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
          => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory
    If type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultActivityViewModelFactory' is on your classpath.
    error: ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.FragmentC' because 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' could not be resolved.
    Dependency trace:
          => element (CLASS): androidx.hilt.lifecycle.ViewModelFactoryModules.FragmentModule
    ComponentProcessingStep was unable to process 'dev.kevalkanpariya.featuretesteduco.EduCoApplication_HiltComponents.FragmentC' because 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' could not be resolved.
    => element (METHOD): provideFactory(androidx.fragment.app.Fragment,android.app.Application,java.util.Map<java.lang.String,javax.inject.Provider<androidx.hilt.lifecycle.ViewModelAssistedFactory<? extends androidx.lifecycle.ViewModel>>>)
          => annotation: @dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory
          => type (ERROR annotation type): dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory
    If type 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'dagger.hilt.android.internal.lifecycle.DefaultFragmentViewModelFactory' is on your classpath.
    4 errors
    Dagger hilt version : 2.42 Kotlin Version: 1.7.0 Gradle Version: 7.4.1 What's causes this error?
  • p

    Pablo

    03/10/2023, 7:44 AM
    Anyone have used `Gradle Managed Devices`and
    Espresso
    tests?
  • b

    Breaker ACT

    03/10/2023, 10:13 AM
    I think Android is vulnerable, the apk could be reversed and read the logic (not too easy but not too hard). Any idea to prevent the app logic/data ? There is few common way I see: 1. Wrap the logic in native code like C, Go and call from Java/Kotlin. But the hacker can use the .so file as the blackbox, they doesn't need care about the logic inside. They just put the input and get output. 2. Encrypt data. But the app have to decrypt to read the data. So attacker can read the reverse code from apk to re-procedure the decrypt logic 3. Put the data in remote source like firebase remote config... The attacker can use runtime tools like frida to read the pure data. So what you's solution to make the apk much possible much to be stolen data/logic ?
    c
    w
    +5
    • 8
    • 31
  • z

    Zaki Shaikh

    03/10/2023, 10:14 AM
    Hello everyone, which unit testing Library is good for Android ? Is JUnit good or other better options are out there?
    b
    a
    • 3
    • 2
  • f

    faisalahmed

    03/10/2023, 11:20 AM
    Hi folks, a question about
    mutableStateListOf()
    . add and remove on the list triggers succesful recompositions of the specific item, but changing the value at any index of this list does not trigger any recomposition. Been scratching my head at this. My
    LazyColumn
    is keyed to a unique
    id
    coming in the data as well. So I am wondering what might be going wrong. Following is an example. Inside
    ViewModel
    val list = mutableStateListOf<Messages>()
    
    fun onMessageChanged(newMessage: Message) {
      val index = list.indexOf(newMessage) // returns correct index
      list[index] = newMessage // does not trigger recomposition
    }
    g
    • 2
    • 1
  • i

    itnoles

    03/11/2023, 2:34 AM
    https://github.com/facebookincubator/dataclassgenerate is Kotlin Data Class is really that bad for Android APK files?
    a
    b
    +3
    • 6
    • 14
  • s

    Slackbot

    03/11/2023, 8:17 AM
    This message was deleted.
    c
    • 2
    • 4
  • b

    Bhupesh Chouhan

    03/13/2023, 6:37 AM
    Hello, team ! I am working on GSM android application. Has anyone experienced in GSM android project???
    c
    • 2
    • 2
  • r

    Ryan Mentley

    03/13/2023, 7:36 AM
    re: the :not-kotlin: emoji, could it maybe have a white background added? It's quite difficult to read in dark mode. (it is shown with a white background when moused over, but not when shown under the message)
    c
    e
    • 3
    • 2
  • j

    Justin Xu

    03/14/2023, 2:26 AM
    How do I exit `androidx.navigation`'s navGraph-scoped viewmodel scope so that those viewmodels can be destroyed, and then reconstructed when I re-enter the navGraph's scope? Right now, I am calling
    (context as Activity).finish()
    inside my fragment, but that doesn't seem to be right.
    i
    c
    • 3
    • 10
  • c

    chanjungskim

    03/14/2023, 3:48 AM
    Anybody knows about this issue? the size doesn't work in Coil library. https://stackoverflow.com/questions/75728922/asyncimage-of-coil-library-doesnt-change-its-size
  • t

    Tarek Mohamed

    03/14/2023, 9:21 AM
    when update android studio to Android Studio Electric Eel | 2022.1.1 Patch this happen in gradle.kts this the error Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.plugin.use.PluginDependenciesSpec'. Check your module classpath for missing or conflicting dependencies any recommendation to fix this issue ?
    a
    • 2
    • 1
  • p

    Prasad Vennam

    03/14/2023, 6:16 PM
    hey guys can anyone help me to make this BeatMotion app with below requirements • A User Interface that allows the user to create and select sounds. There should be at least a few available sounds included with the application. The user should also be able to include their own sounds which may be recorded or selected from files. • ● The user should also be able to manipulate sound playback in at least 2 ways (changing playback speed, and frequency are examples) • ● Users should be able to play more than one sound back at a time, changing parameters about each sound playback. • ● At least one of the parameters of the playback that is changeable must be changed using another hardware function. In the video I do this by using the orientation of the phone to change the playback rate of the sound, but this can be done in any combination you like and does not have to include movement of the phone.
    c
    m
    • 3
    • 2
  • d

    Derek Alves

    03/15/2023, 12:15 AM
    Guys, has anyone gone through this?
    
    FragmentContainerView must be within a FragmentActivity to use android:name="com.example.meditation_ui.MessageFragment"
    b
    • 2
    • 5
  • c

    Colton Idle

    03/15/2023, 3:42 AM
    My kotlin lang slack search if failing me but i think someone here said that AAC ViewModels with public suspend functions are a code smell. Am I remembering correctly? Or are public suspend functions fine?
    p
    j
    • 3
    • 2
  • w

    With Universe

    03/15/2023, 9:47 AM
    Is it safe to store apikey on AWS env servers?
  • w

    With Universe

    03/15/2023, 9:49 AM
    I am aware of the existence of Secret Manager, but it would add an additional cost
  • m

    Michael Vandendriessche

    03/15/2023, 10:49 AM
    Hey everyone. I just wanted to know if this is a good practice.
    @JsonClass(generateAdapter = true)
    data class Command(
        val cmd: String
    ){
        companion object{
            val firstCommand = Command("command1")
            val secondCommand = Command("command2")
            val thirdCommand = Command("command3")
        }
    }
    I have a data class which is parsed to/from json by Moshi. some Commands contain a string which needs to be calculated but in some cases it can be a static string. I could make an enum with the default command strings or a sealed class with objects with a Command value. But this one seems more practical to use
    Command.firstCommand
    and it saves me an extra file/class with default values. I don't see a problem with it other than it looks a bit strange.
  • k

    KotlinLeaner

    03/15/2023, 11:26 AM
    Hi guys, I want to use
    delay
    in my launch function. I always use
    xxxL
    value for
    delay
    . Is there any function to convert
    seconds
    ,
    minutes
    &
    hours
    . For example / For 30 second
    delay(30)
    // For 1 minute
    delay(1)
    // For 2 Hour
    delay(2)
    It's so much confusing to multiple by value. Thanks
    m
    g
    • 3
    • 7
  • f

    Fabio Berta

    03/15/2023, 2:06 PM
    Hi, I have certain functionality that is used by multiple view models. I'd like to centralise this into a separate object and use it in the view models through delegation. However, to perform its actions that object needs a coroutine scope -> viewModelScope. Is there a clean way to provide this to the delegate while still benefitting from the
    by
    syntax? All solutions I found so far rely on runtime exceptions which I would like to avoid. Any ideas?
    • 1
    • 1
  • v

    vesp

    03/15/2023, 8:26 PM
    Question about this bit of code:
    fun Float.convertDpToPx(): Float = this * Resources.getSystem().displayMetrics.density
    What is that technique called where its structured
    fun <TYPE>.<FUNCTION_NAME>(...).....
    . Is this called a class extension?
    e
    • 2
    • 1
  • s

    Sandeep Kulkarni

    03/16/2023, 7:18 AM
    Hello Community Whats the main difference between FragmentContainer view and fragment tags
    d
    • 2
    • 1
  • d

    Danish Ansari

    03/16/2023, 1:48 PM
    Can someone please explain me the difference between
    @kotlinx.parcelize.Parcelize
    and
    @kotlinx.android.parcel.Parcelize
    annotation? They have exact same documentation and both come from
    kotlin-parcelize
    gradle plugin. Android Studio warns that later one is deprecated but I can clearly see that
    kotlinx.android.parcel.Parcelize.kt
    is not annotated with
    @Deprecated
    , so where is the warning coming from?
    z
    • 2
    • 2
Powered by Linen
Title
d

Danish Ansari

03/16/2023, 1:48 PM
Can someone please explain me the difference between
@kotlinx.parcelize.Parcelize
and
@kotlinx.android.parcel.Parcelize
annotation? They have exact same documentation and both come from
kotlin-parcelize
gradle plugin. Android Studio warns that later one is deprecated but I can clearly see that
kotlinx.android.parcel.Parcelize.kt
is not annotated with
@Deprecated
, so where is the warning coming from?
z

zsmb

03/16/2023, 3:32 PM
It’s the Parcelize plugin itself producing the warning, through the compiler. https://github.com/JetBrains/kotlin/blob/6af1c550b61341998208e2c6c2aaa4301fce00c8/[…]rc/org/jetbrains/kotlin/parcelize/ParcelizeAnnotationChecker.kt https://github.com/JetBrains/kotlin/blob/6af1c550b61341998208e2c6c2aaa4301fce00c8/[…]ns/kotlin/parcelize/diagnostic/DefaultErrorMessagesParcelize.kt
d

Danish Ansari

03/16/2023, 3:40 PM
Thanks @zsmb for clarifying
View count: 6