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
  • k

    Kamal

    12/25/2020, 4:37 PM
    Hello world, I'm newbie in android and by reading in android developer site I implemented my network calls with volley library in my project. But I can see the community prefer retrofit. Is there any benefits if I still stick with volley?
    :stackoverflow: 2
    :google: 3
    🇳🇴 2
    u
    t
    2 replies · 3 participants
  • k

    Krotick

    12/26/2020, 6:00 AM
    I have tried to use KTor for a KMM (Kotlin Multiplatform Mobile) project but the shared module (commonMain) doesn't see the ktor library after I've added it as a dependency ... Anyone had success with using KMM or is it not ready yet?
    a
    1 reply · 2 participants
  • c

    Ch8n

    12/27/2020, 8:10 PM
    🤓✌️ hola amigos! Many haven't yet migrated their codebase from synthetic binding and findviewBy Id, I would like to share my article on viewbinding for that, I have explained in detail some of the patterns, anti Pattern and regarding and few facts that are there in it . Do checkout if your new to viewbinding and if your experienced with it do share your thoughts on anyone of the section which you find intresting. Chao! 👨‍💻 #feed https://chetangupta.net/viewbinding/
    🔥 2
    ❤️ 1
    j
    2 replies · 2 participants
  • m

    Mattia Tommasone

    12/28/2020, 9:51 PM
    Hello everyone, I haven’t really been writing Android code for years now so I’m not familiar with the Android ecosystem. I have a multi-target Kotlin project and i received a PR that converts all the Android tests to be executed with Robolectric rather than being executed on an actual, or emulated, device. Not being familiar with the ecosystem, I can’t say if it’s a safe choice or not. Any ideas on this? I know it’s a pretty vague question but I probably just need to gather some opinions on this
    r
    l
    3 replies · 3 participants
  • t

    teddy

    12/29/2020, 10:35 AM
    I just upgraded MacOS and Android Studio to latest version yesterday, and I could not do anything on any dialog opened in Android Studio if Android Studio in Full-screen mode. It means all dialog opened is included in the tabs containing code files and when I click on it, nothing happen then. Anyone faced this problem and how to fix it? Thank you~~
    b
    s
    3 replies · 3 participants
  • a

    Aness Iqbal

    12/29/2020, 4:09 PM
    How do we access strings resources outside the fragment or activity. I am doing the following:
    App.context.getString(R.string.rupees, min.toString())
    But with application context static reference like that I am not able to change the strings based upon locale. How should update the app context or restart the whole app? Can anyone help?
    d
    a
    +1
    8 replies · 4 participants
  • t

    tony

    12/29/2020, 7:36 PM
    Cross-posting from the gradle community slack (https://gradle-community.slack.com/archives/CA7UM03V3/p1609220513181600) I'm trying to understand the root cause of this error message:
    * What went wrong:
    An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.android', version: '1.4.21']
    > Failed to apply plugin 'org.jetbrains.kotlin.android'.
       > Extension with name 'android' does not exist. Currently registered extension names: [ext, kotlin, kotlinTestRegistry]
    which is a result of the following setup:
    // root build.gradle
    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:4.2.0-alpha15"
        }
    }
    // app/build.gradle
    plugins {
        id 'com.android.application'
        id 'org.jetbrains.kotlin.android' version '1.4.21'
    }
    and then executing
    ./gradlew help
    . Build scan: https://scans.gradle.com/s/t7w3bwv3pingm/build-dependencies?toggled=W1swXSxbMV0sWzEsMF0sWzAsMF0sWzAsMV1d I recognize, btw, that this is a non-standard setup. To reiterate, my goal is to understand what that error means and why it happens.
    j
    5 replies · 2 participants
  • r

    rkeazor

    12/30/2020, 1:02 AM
    Does anyone use coroutines inside there recyclerview? if so how do you define the lifecycle of scope?
    j
    m
    +1
    5 replies · 4 participants
  • y

    Yaroslav Nesterov

    12/30/2020, 12:47 PM
    kodein_db = "0.4.0-beta"
    implementation("org.kodein.db:kodein-db-jvm:$kodein_db")
    implementation("org.kodein.db:kodein-db-serializer-kotlinx:$kodein_db")
    implementation("org.kodein.db:kodein-db-serializer-kryo-jvm:$kodein_db")
    led to
    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/kodein/db/leveldb/jvm/LevelDBJvm
    implementation("org.kodein.db:kodein-db:$kodein_db")
    implementation("org.kodein.db:kodein-db-jvm:$kodein_db")
    implementation("org.kodein.db:kodein-db-serializer-kotlinx:$kodein_db")
    implementation("org.kodein.db:kodein-db-serializer-kryo-jvm:$kodein_db")
    led to
    Duplicate class org.kodein.db.impl.AbstractDBFactory found in modules jetified-kodein-db-debug-runtime (org.kodein.db:kodein-db-android-debug:0.4.0-beta) and jetified-kodein-db-jvm-0.4.0-beta (org.kodein.db:kodein-db-jvm:0.4.0-beta)
    for 99 classes
    implementation("org.kodein.db:kodein-db:$kodein_db")
    implementation("org.kodein.db:kodein-db-serializer-kotlinx:$kodein_db")
    implementation("org.kodein.db:kodein-db-serializer-kryo-jvm:$kodein_db")
    led to
    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/my.app.debug-PdUtRd44w96MN7OUXipZlg==/base.apk"],nativeLibraryDirectories=[/data/app/my.app.debug-PdUtRd44w96MN7OUXipZlg==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "libkodein-leveldb-jni.so"
    what am I doing wrong? is the use of
    kts
    mandatory? I still have the
    build.gradle
    doc: https://docs.kodein.org/kodein-db/0.4/core/install.html
    k
    e
    5 replies · 3 participants
  • a

    Ayomide

    12/30/2020, 4:08 PM
    Anyone here using Jetpack Compose? I'm wondering what the best way to stream messages from a web socket and have them display in composable - while using "idiomatic" Kotlin (i.e. coroutines). There seems to be not too many examples of web sockets with coroutines online, and no examples with jetpack compose. So it would be great if anyone had any suggestions at things to look at 🙂
    a
    k
    +1
    7 replies · 4 participants
  • c

    Christian Dräger

    12/31/2020, 9:40 PM
    Hey, I never wrote an android app before but have several years of experience in kotlin on the jvm / server. Since I have a little idea for an clock widget that I would like to create, are there some good and state of the art tutorials / guides on how to create such a widget. Everything I found on YouTube is older than 2 years+ and I assume much has changed since.
    r
    k
    +1
    5 replies · 4 participants
  • f

    Florian

    01/02/2021, 7:04 AM
    How do you handle progress bars when you're loading something from a Flow? Where do you set the progress bar to visible/gone? For example:
    private val activeChatsFlow = sessionManager.chatUserFlow.flatMapLatest { user ->
            repository.getActiveChatsForUser(user.uid!!)
       }
    Are
    onStart
    and
    onCompletion
    the right combination?
    t
    f
    +3
    17 replies · 6 participants
  • m

    Mehdi Haghgoo

    01/02/2021, 4:52 PM
    I cannot enable transition for my Android app (non-compose). Tried enabling in theme and in code. None of them worked. Issue is similar to this (unsolved) StackOverflow issue. Does anyone have an idea why this happens? Tried on Android 10 and 11. Window and content transitions don't seem to be working.
    c
    1 reply · 2 participants
  • b

    birdsofparadise

    01/02/2021, 9:45 PM
    Hello I am using
    Kotlin: 1.4.21
    Android Studio: Arctic Fox (canary)
    Android Gradle Build Tools: 7.0.0-alpha03
    Gradle: 6.8-rc-4
    It appears the
    packagingOptions
    's
    merge
    API has been removed. Is
    packagingOptions.resources.merges
    the replacement for merge in
    META-INF
    R8 data? Ex: From:
    packagingOptions {
        merge("META-INF/popkorn.provider.mappings")
        merge("META-INF/popkorn.resolver.mappings")
    }
    To:
    packagingOptions {
       resources {
          merges += "META-INF/popkorn.provider.mappings"
          merges += "META-INF/popkorn.resolver.mappings"
       }
    }
    j
    5 replies · 2 participants
  • g

    Glenn Martin

    01/03/2021, 2:59 AM
    Hi, I've picked up JetPack Compose for Desktop, any idea how to do navigation? the nagivation library currently in Jetpack doesn't seem to support desktop
    c
    2 replies · 2 participants
  • a

    André Thiele

    01/03/2021, 12:59 PM
    Is there an option in AS Canary to automatically refresh Compose previews?
    c
    1 reply · 2 participants
  • t

    trinadhchinna7

    01/04/2021, 6:11 AM
    Hi I need to learn compose for my next project but I don't know where to start any suggestions please
    s
    c
    +1
    3 replies · 4 participants
  • h

    heisenberg

    01/04/2021, 8:45 AM
    I read the blog post the jetpack compose 1.0 stable release this year, do anyone know the timeline of this stable release?
    f
    c
    +1
    5 replies · 4 participants
  • s

    san

    01/04/2021, 10:11 AM
    how to show progress while uploading files
    :stackoverflow: 3
    s
    d
    10 replies · 3 participants
  • z

    ziv kesten

    01/04/2021, 1:24 PM
    I am trying to unit test* a Room Dao Query that Returns a PagingSource From Paging 3*, i found the SO question that describes exactly what i was looking for but there is no answer, has anyone figured out how to test PagingSource? https://stackoverflow.com/questions/65164206/how-to-unit-test-a-room-dao-query-that-returns-a-pagingsource-from-paging-3
    s
    b
    +1
    18 replies · 4 participants
  • s

    san

    01/05/2021, 5:27 AM
    how to get the file size from uri
    :stackoverflow: 5
    r
    s
    6 replies · 3 participants
  • r

    Ragupathy Mani

    01/05/2021, 5:49 AM
    Team good morning i have one doubt anyone suggest me the good way to solve below my problem I have one api call logic to use multiple activities and fragments. So do I need to define that method in one viewmode and that viewmodel needs to use all the places? But based on google document one activity should have only one view model. So how to do it now? Should I write logic for all the viewmodel?
    :stackoverflow: 1
    s
    d
    +1
    8 replies · 4 participants
  • e

    eygraber

    01/05/2021, 8:59 AM
    I use Parcelize, and I've been getting Crashlytics reports about this error for almost 2 years now, for all versions of Android I support (7-11), on a wide range of devices:
    <http://java.io|java.io>.InvalidClassException: cannot bind enum descriptor to a non-enum class
    Has anyone else been seeing anything like this, or know if this is related to Parcelize? Someone recently filed a similar issue on the AOSP tracker - https://issuetracker.google.com/issues/173343983
    f
    2 replies · 2 participants
  • d

    dan.the.man

    01/05/2021, 5:13 PM
    Question, I have
    fun getString(@StringRes resId: Int, vararg formatArg:Any) = activity()?.getString(resId, formatArg)
    So I can call this instead of needing the context in every screen. But it doesn't correctly format, and it just displays
    lang.Object@zlkjdf
    If I change the method to Java, it works though. Is some conversion going wrong from Kotlin to Java?
    t
    2 replies · 2 participants
  • b

    buszi0809

    01/05/2021, 5:37 PM
    I'm tryna use Jetpack Composed with latest 1.0.0-alpha09 version and I can't find @Preview. Did they delete it?
    a
    c
    2 replies · 3 participants
  • k

    Kshitij Patil

    01/06/2021, 7:51 PM
    Are there any best practices/designs you follow while handling API errors when using retrofit with Coroutines? I'm currently following this article to handle errors as states using sealed classes but I'm not sure how should I deal with mapping those errors with string resources so that I could support them in multiple languages. Also, error responses with multiple json formats is yet another challenge for me. Any links to articles you'd recommend or a brief idea would also work. Thanks!
    j
    c
    6 replies · 3 participants
  • q

    qasim majeed

    01/07/2021, 9:15 AM
    Execution failed for task ‘:app:kaptAdpDebugKotlin’.
    A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
    > java.lang.reflect.InvocationTargetException (no error message) HI All getting this error while integrating Room if i emptied the DAO Eeverthing is working fine
    e
    v
    +1
    3 replies · 4 participants
  • t

    teddy

    01/07/2021, 12:34 PM
    One question about lifecycleobserver, After I debugged on galaxy S9 and detected lifecycleobserver is not much accurate, when I quit app (send it to background) and open it again continuously , sometime onStop doesnt work and it then failed to trigger any event of onStart and onStop then. Anyone faced this problem and found a solution? I just wanted to detect if or not app is in background to process the event of passcode screen of the App. Thank you so much
    d
    4 replies · 2 participants
  • l

    Lilly

    01/07/2021, 4:35 PM
    Hi, I'm looking for an elegant way to find a sequence of bytes in a byte array, e.g. find the sequence [0xFF] [0xFF] [0xFF] [0xFF]. Can someone help me?
    v
    e
    7 replies · 3 participants
  • m

    Miguel Quinta

    01/07/2021, 5:30 PM
    Hi all!! I'm using a widget Switch in my App and I'm having this warning in Android Studio:
    "Use SwitchCompat from AppCompat or SwitchMaterial from Material library"
    Not sure what are the methods, code, to correct this. Someone been trough this recently? To point me in the right direction
    j
    2 replies · 2 participants
Powered by Linen
Title
m

Miguel Quinta

01/07/2021, 5:30 PM
Hi all!! I'm using a widget Switch in my App and I'm having this warning in Android Studio:
"Use SwitchCompat from AppCompat or SwitchMaterial from Material library"
Not sure what are the methods, code, to correct this. Someone been trough this recently? To point me in the right direction
j

Javier

01/07/2021, 5:42 PM
SwitchCompat should be in the appcompat library, and the material one should be here https://github.com/material-components/material-components-android
m

Miguel Quinta

01/07/2021, 6:09 PM
Thank you Javier!!! I will look into this later at home Thanks
View count: 9