https://kotlinlang.org logo
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
  • m

    Mohammad Jahidul Islam

    12/23/2021, 4:32 PM
    I have made an app last year and published it on playstore, just for fun. And delete the source file. Now the users are requesting for fixing some know bugs and give it a morder look. ❓ Is it possible to update the version. If I write it again from scratch.
    :not-kotlin: 1
    c
    a
    • 3
    • 2
  • a

    André Thiele

    12/24/2021, 7:33 AM
    Hello everyone. How can I enforce a specific Kotlin version in Gradle? Some dependency seems to override it to 1.6.0, which makes it incompatible with Compose 1.0.5
    f
    l
    • 3
    • 5
  • a

    Aaron Waller

    12/25/2021, 5:41 PM
    What is the best practice for uploading images from device storage to a server in android with kotlin? Currently building a social media app where the user can create content which gets uploaded to my database via Apollo GraphQL mutations. But I’m not sure on how to upload the image from the device to my server? I want to save the url to that image on my database.
    :not-kotlin: 1
    m
    • 2
    • 2
  • l

    Lucca Beurmann

    12/25/2021, 6:37 PM
    What's the correct way of testing shared flows? I have a shared flow that emits events to the UI (Show an error toast for example) but in the Vm's unit test that asserts the shared flow emission are stuck and keep running forever
    g
    • 2
    • 3
  • k

    Kazem Moridi

    12/26/2021, 2:31 PM
    Hello everyone, is there any way to access a kotlin file that have a class and implement a interface in the internal storage or even get it from web and use it inside the application after the application was compiled. This kotlin file is a add-on to application.
    m
    • 2
    • 2
  • c

    Chetan Tuteja

    12/27/2021, 7:30 AM
    Hi guys! Quick question. Let us say I have a string array and I have another variable and I am just checking if that variable is in the array. I can directly use the 
    in
     check for that. Is there any way to do the same check while ignoring case check? I am trying to fetch string array from XML. I know I can do
    any
    check, but is there a better more elegant way?
    val abc = "abc"
    val random = arrayOf("ABC", "egf")
    
    val isThere = abc in random // Prints false
    
    app.resources.getStringArray(R.array.models).any { model -> model.equals(PrefUtils.getBuildModel(), ignoreCase = true) }
    m
    • 2
    • 1
  • k

    Kwangjo Lee

    12/28/2021, 5:25 AM
    Anybody knows about snapshot.zip file in build artifects? This file sometimes locked while build project, so project return error (caanot delete that file.)
    :not-kotlin: 2
    • 1
    • 3
  • a

    An Tran

    12/28/2021, 7:09 AM
    Hello everyone, do you know channel for webapp ?
    d
    l
    • 3
    • 2
  • d

    Dhaval Gondaliya

    12/28/2021, 11:32 AM
    I am trying to convert array from navigation argument to list with kotlin extension but it is giving me this error. can anyone suggest problem with it?
    v
    • 2
    • 2
  • a

    Alex

    12/28/2021, 12:44 PM
    I am having trouble with ExoPlayer playing an internal video from the downloads folder, SecurityPermissions all around. Code in 🧵
    :not-kotlin: 3
    • 1
    • 5
  • a

    Aaron Waller

    12/29/2021, 5:25 AM
    I tried to find the best practice for uploading files from an android device to my server. Due to the fact that I fetch all my user data with Apollo GraphQL Client, I tried to use that library for the file upload as well. The mutation for saving all kinds of infos about the file on my database works fine but I cannot really figure out how to upload files/images to my server? I saw that this is possible with Apollo Client but I cannot really find a good explanation on that which explains both sides, server and client side implementation. Is it a good thing to combine Apollo GraphQL and OkHttp3 + PHP script? I would use OkHttp3 + PHP Script to save the file on my server and then Apollo GraphQL Android client to send a mutation with all kinds of info (imageURL, name, content, author, date, isPublished, category, tags) to my Node.js Apollo GraphQL API which saves that on my MySQL Database. Or maybe replace OkHttp3 with Retrofit? Is that a good approach?
    :not-kotlin: 5
    u
    • 2
    • 1
  • n

    Nikola Milovic

    12/29/2021, 11:10 AM
    Hello everyone, havent done pure Native Android development in a while, last time I did, ViewModel fragments were the go to, alongside Repository/ UseCase pattern. Everything would be split into either Feature modules or Data/Domain/Presentation. (Everything i mentioned is of course opinionated, but this did provide quite a nice layout for the project) Now my question is what is todays goto clean architecture, tech stack considering Compose is staple for UI, are there any new libraries that make development easier? Any sample projects/ examples and your opinions are highly appreciated.
    :not-kotlin: 5
    m
    n
    • 3
    • 3
  • s

    Sergio C.

    12/29/2021, 12:49 PM
    !is
    how can we create an extension or infix function for
    !is
    to use it like`someVar isnot String`?
    d
    • 2
    • 7
  • c

    Chris Fillmore

    12/29/2021, 4:27 PM
    For a greenfield Kotlin-Android project, what Java version should I be targeting? Currently I’m using 11 but I’m wondering if there’s any benefit to later versions? Thanks for any advice.
    c
    g
    • 3
    • 5
  • d

    dave08

    12/30/2021, 12:35 PM
    Is it possible to compile multiple android gradle modules into one aar file using Kotlin DSL?
    e
    • 2
    • 2
  • e

    eygraber

    12/30/2021, 9:41 PM
    I've been getting a crash related to something that I
    Parcelize
    for a while now. It happens very infrequently, and I've never been able to repro it. Seems to only happen on Android 9 and Android 11 across all manufacturers (although that could be the small sample size coming into play). The code is:
    interface State : Parcelable
    
    interface StringId {
      val raw: String
    }
    
    @Parcelize
    internal data class MyState(
      val personId: PersonId?
    ) : State
    
    @JvmInline
    value class PersonId(override val raw: String) : StringId
    Stacktrace in 🧵
    • 1
    • 3
  • s

    spierce7

    12/31/2021, 6:48 PM
    In Kotlin script gradle I’m trying to:
    plugins.withId("com.android.library") {
        configure<LibraryPlugin> {
            android {
            }
        }
    }
    but I can’t resolve
    android { }
    in my build script. What do I need to configure in order to resolve this?
    g
    v
    • 3
    • 5
  • m

    Milan Vadhel

    01/03/2022, 6:08 AM
    Hi, Is there any channel to post the questions regarding CICD with Github Action + Fastlane + Firebase App distribution?
    a
    k
    • 3
    • 4
  • m

    Manan Kansara

    01/03/2022, 9:48 AM
    hello there i am learning kotlin for android evelopment here happy to share you.😀
    s
    a
    • 3
    • 3
  • r

    Remon Shehata

    01/03/2022, 10:01 AM
    Hi, is there a difference between those 2 options here:
    fun main() {
        var text: String? = "hello"
        text?.let { 
            print(text) // option 1
            print(it) // option 2
        }
    }
    m
    m
    +5
    • 8
    • 16
  • b

    Breaker ACT

    01/04/2022, 3:52 AM
    Anyone have worked with multi modules and multi back stack graph navigation? I have searched a week but seem there is not good practice for my issue. Do you have any example for this
    t
    f
    • 3
    • 6
  • s

    Sanjeeviraj M

    01/04/2022, 1:50 PM
    Does Parcelize Kotlin Android extension have any major impact in build time? is it a good idea to add Parcelize annotation to all model classes?
    a
    • 2
    • 1
  • p

    PanicMonster

    01/04/2022, 2:38 PM
    in a kotlin function i did something like this
    fun f(){
    
    	val reportAbout = binding.createReportReportAboutTextView.text.toString()
            val reportDesc = binding.createReportEditText.text.toString()
            var imageURL = ""
            var videoURL = ""
            val timestamp = System.currentTimeMillis()/1000
    
            var filename = UUID.randomUUID().toString()
    
    	imgref = FirebaseStorage.getInstance().getReference("/report_videos/$filename")
            if(selectedVideoURI!=null)
                imgref.putFile(selectedVideoURI!!).addOnSuccessListener {
                    imgref.downloadUrl.addOnSuccessListener {
                        videoURL = it.toString()
                        ref.setValue(ReportModel(ref.key.toString(),reportAbout ,reportDesc,imageURL,videoURL,timestamp))
                    }
                }
    
    	// LOG.d("TAG","$videoURL")
    }
    whenever i print videoURL in logcat, it shows empty, but inside imgref.putFile() function it has some value. does the imgref.putFile() funciton executes last in order? how can i execute the commented line in last by order.
    d
    • 2
    • 1
  • i

    Ihor Kviten

    01/04/2022, 10:31 PM
    Hi! I am a newbie in Kotlin and Android, going through https://developer.android.com/jetpack/compose/tutorial. But it seems for using layouts (and elements such as Row/Column) I need to
    import androidx.compose.foundation.layout.Column
    package, is it correct? Because in my case I'm getting "Unresolved reference" for Row or Column P.S. Nevermind, it fixed the issue. Strange design idea for me. What if Jetpack-Compose devs want to add new elements in the future? Isn't it better to import the whole layout package once at all?
    r
    c
    • 3
    • 4
  • o

    Orhan Tozan

    01/05/2022, 5:39 PM
    Will there be new Android Jetpack releases today? Edit: kind of Kotlin related, because there is a bug with Kotlin 1.6.10 when updating to compose 1.1
    :not-kotlin: 2
    c
    k
    p
    • 4
    • 6
  • r

    ritesh

    01/05/2022, 6:32 PM
    Hi, Any one tried
    Code With Me
    plugin for
    Android Studio Arctic Fox
    ?
    ✅ 3
    c
    x
    • 3
    • 13
  • a

    Alderson Elliot

    01/08/2022, 4:59 PM
    Hello I have a question about accompanist FlowRow, How to achieve grow & shrink
    ✅ 1
    m
    • 2
    • 1
  • o

    onirutlA

    01/10/2022, 3:24 AM
    Are using kotlin flow builder on function is creating memory leak
    override fun getUsersSearch(username: String) = flow<Resource<List<UserDTO>>> {
        emit(Resource.Loading())
    
        localDataSource.getUserSearch(username).collect { fromDb ->
            when (fromDb) {
                is FromDb.Success -> {
                    val dtos = mapNullInputList(fromDb.data) { it.toDto() }
                    emit(Resource.Success(dtos))
                }
                is FromDb.Empty -> {
                    when (val networkState = remoteDataSource.getUserSearch(username)) {
                        is FromNetwork.Success -> {
                            val fromNetwork = networkState.body
    
                            val cache = mapNullInputList(fromNetwork) { it.toEntity() }
    
                            localDataSource.insertUsers(cache)
    
                            val dto = mapNullInputList(fromNetwork) { it.toDto() }
    
                            emit(Resource.Success(dto))
                        }
                        is FromNetwork.Error -> {
                            emit(Resource.Error(networkState.message))
                        }
                    }
                }
            }
        }
    
    }.flowOn(ioDispatcher)
    c
    g
    • 3
    • 16
  • r

    Rahul Ray

    01/10/2022, 7:17 AM
    Hi everyone, I am implementing in-app updates in my app. Here I need to check whether the update was flexible or immediate. But at the time of pushing an update how can I define whether the following update is flexible or immediate?
    :not-kotlin: 1
    m
    c
    • 3
    • 4
  • v

    Vivek Sharma

    01/10/2022, 3:46 PM
    I have a question, when I have entity like this:
    @Entity
    data class Note(
        val title: String,
        val content: String,
        val timestamp: Long,
        val color: Int,
        @PrimaryKey val id: Int? = null
    )
    and when I create Note object, and passing
    null
    to
    id
    , what room will assign to it? In my case it is assigning
    1, 2, 3, 4...
    like it is autoGenerating, is this correct what I am thinking?
    h
    e
    • 3
    • 2
Powered by Linen
Title
v

Vivek Sharma

01/10/2022, 3:46 PM
I have a question, when I have entity like this:
@Entity
data class Note(
    val title: String,
    val content: String,
    val timestamp: Long,
    val color: Int,
    @PrimaryKey val id: Int? = null
)
and when I create Note object, and passing
null
to
id
, what room will assign to it? In my case it is assigning
1, 2, 3, 4...
like it is autoGenerating, is this correct what I am thinking?
h

hfhbd

01/10/2022, 3:52 PM
Yes https://developer.android.com/reference/kotlin/androidx/room/PrimaryKey#autogenerate
e

ephemient

01/10/2022, 4:34 PM
FYI there is a #room channel
:thank-you: 1
View count: 2