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

    rg

    03/12/2019, 8:31 AM
    Hi guys, how are u dealing with network connection changes after Lollipop (once Google dissuade to use broadcastReceiver)? I would like to notify all my activities when the user loses network connection. I have been reading about jobScheduling to deal with that but I’m not totally convinced maybe it’s not the perfect place to ask it, sorry in advance
    :stackoverflow: 3
    c
    • 2
    • 1
  • d

    dave

    03/12/2019, 11:46 AM
    Hi guys, I'm having this compilation issue:
    error: cannot find symbol
    @Generated()
    error: package javax.annotation.processing does not exist
    import javax.annotation.processing.Generated
    It seems to be related to dagger2, happens when I try to run my Espresso tests in my ec2 instance. I'm using Open JDK11, Gradle 4.10. Any Ideas?
    s
    s
    • 3
    • 7
  • p

    Paulius Ruminas

    03/12/2019, 12:22 PM
    Hello, does anyone have an example how to set Dispatchers.IO as okhttp3 Dispatcher?
    g
    • 2
    • 8
  • b

    Bilagi

    03/13/2019, 12:14 PM
    What is the exact difference between
    map
    and
    switchMap
    in
    transformation
    and when to use it ?
    a
    • 2
    • 1
  • l

    Lou Morda

    03/13/2019, 3:30 PM
    Hello everybody does anyone have sample code or github project showing how to write unit tests in Android for the new-ish stable Kotlin coroutines 1.x.x? I had a project using MVVM and Kotlin experimental coroutines. My unit tests are failing now that I upgraded. I added this: testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$rootProject.coroutineVersion" and have resolved one of the issues but now I'm getting a getMainLooper is not mocked error. Was hoping someone could help me out, thanks!
    g
    • 2
    • 3
  • r

    rkeazor

    03/13/2019, 8:17 PM
    .
    🤔 4
    🐱 2
    🤦‍♂️ 1
    😂 6
    👀 7
    • 1
    • 1
  • c

    christian.steffensen

    03/14/2019, 8:52 AM
    Hi! Does anyone know if it’s possible to have an abstract function that takes an interface as parameter, and then when overriding that method it would use the specific implementation of that interface? I’m guessing I have to use generics, but I can’t get it to work…
    class StartViewModel() : BaseViewModel() {
        sealed class Input : IInput {
            object ButtonClicked : Input()
        }
    
        override fun handleInput(input: IInput) { //I want this to be of the type Input, instead of the interface      
        }
    }
    
    abstract class BaseViewModel {
        interface IInput
        protected abstract fun handleInput(input: IInput)
    
        init {
            handleInput(something that implements IInput)       
        }
    }
    s
    • 2
    • 2
  • z

    zokipirlo

    03/14/2019, 8:57 AM
    If starting new app with min api 21 should I use
    vectorDrawables.useSupportLibrary = true
    in gradle and
    srcCompat
    on
    ImageView
    for vector images or is it ok to use just
    android:src
    ? Are there any fixes for older Android versions in compat version like for
    Fragments
    ? Maybe @jw can help me with background info on that? Thanks!
    :stackoverflow: 2
    t
    • 2
    • 1
  • k

    katz

    03/14/2019, 9:44 AM
    Does anybody have same? how do u fight it? (appears time by time, usualy clean cache is helped but not this time
    b
    • 2
    • 1
  • f

    Fredrik Larsen

    03/14/2019, 11:07 AM
    Can anyone recommend a book on RxJava (kotlin) with Android? I'm learning from examples and reading articles, but I have some knowledge gaps I'd like to fill.
    t
    • 2
    • 4
  • v

    victor herasme perez

    03/14/2019, 11:26 AM
    Hi. I have cloned a repo with an AndroidStudio project and I opened it in IntelliJ but the project doesn't build. Has anyone seen this before?
    :stackoverflow: 3
    f
    o
    r
    • 4
    • 5
  • v

    victor herasme perez

    03/15/2019, 9:35 AM
    Hi. What do I need to import so that Android Studio recognizes this? Or is it a project setting?
    a
    s
    b
    • 4
    • 6
  • g

    ghosalmartin

    03/15/2019, 11:19 AM
    anyone know why in this instance casting to
    T
    is unchecked?
    d
    • 2
    • 2
  • u

    ubu

    03/15/2019, 3:04 PM
    Hi there. I have this message in logs. Could you tell me what does it mean? My app is heavy loaded with map and markers on it.
    c
    • 2
    • 3
  • u

    Ubi

    03/15/2019, 5:49 PM
    🗡️ + :java: + :kotlin: + kapt = ☠️ + 😭 😭 😭 😭 😭 😭 How can I resolve this:
    > Task :app:compileDebugKotlin FAILED
    e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
        class com.om.nx.di.DaggerAppComponent, unresolved supertypes: AppComponent
    Only occurs when running unit tests .
    😀 1
    • 1
    • 1
  • b

    Bruno_

    03/16/2019, 1:58 PM
    hey, anyone been porting gradle to use kotlin dsl? I'm trying to but no matter what, I get
    > The 'java' plugin has been applied, but it is not compatible with the Android plugins.
    My guess is that
    kotlin-dsl
    plugin includes java plugin which interferes with android plugin. Anyway, I have literally no idea how to repair it
    g
    • 2
    • 13
  • g

    galex

    03/18/2019, 11:47 AM
    Hello, since the last (?) AS upgrade I can’t put a breakpoint on a line with an if condition. I am the only one having this issue?
    l
    g
    n
    • 4
    • 6
  • a

    Alex

    03/18/2019, 12:52 PM
    Hey everyone, Maybe someone can help me out? I am creating a Moshi Codegen adapter like so:
    @JsonClass(generateAdapter = true)
    data class NetPost(
        val id: Int,
        @RenderedText val title: String,
        @RenderedText val excerpt: String,
        @RenderedText val content: String,
        val images: NetPostImages,
        @UtcDateTime @Json(name = "date_gmt") val date: ZonedDateTime,
        @UtcDateTime @Json(name = "modified_gmt") val modified: ZonedDateTime
    )
    Setting up my moshi instance like so
    Moshi.Builder()
        .add(RenderedTextAdapter())
        .add(UtcDateTimeAdapter())
        .build()
    And am using all of this inside Retrofit When accessing the api, i get the following error:
    java.lang.IllegalArgumentException: Unable to create converter for java.util.List<(...).NetPost>
    Seems like I missed something with my setup? The
    NetPostJsonAdapter
    class is generated correctly, but it does not seem to work inside of a List.. ?
    e
    • 2
    • 2
  • k

    katz

    03/18/2019, 1:36 PM
    any solution on this? (clearing caches, reimports not helping)
    e
    r
    +2
    • 5
    • 4
  • r

    ribesg

    03/19/2019, 3:50 PM
    Do we still have no proper keyboard show/hide event handling on Android in 2019? /rant
    😁 1
    :stackoverflow: 3
    👍 3
    d
    l
    a
    • 4
    • 6
  • f

    Fredrik Larsen

    03/19/2019, 8:43 PM
    If you're wondering why I ask this in a kotlin related channel, it is because I see multiple examples where people use
    lazy
    or
    lateinit
    which will retain the instances. The same goes for views, unless you use synthetics which in itself is a bit "hacky" imo.
    g
    s
    • 3
    • 21
  • j

    Justin

    03/22/2019, 1:46 AM
    I've looked pretty thoroughly in GitHub and
    stackoverflow
    and have not been able to find an example of the following: Has anyone ever created an android library that can receive push notifications, without any sort of coordination with the app that is hosting it?
    :stackoverflow: 5
    g
    • 2
    • 3
  • r

    rishabhsinghbisht

    03/22/2019, 8:07 AM
    is there any simpler way to do this?
    -.kt
    g
    a
    z
    • 4
    • 4
  • f

    Fredrik Larsen

    03/25/2019, 9:52 AM
    Due to dead code elimination I usually do:
    if (BuildConfig.DEBUG) Timber.d(...)
    Is the compiler smart enough to do the same if I make an inline function for that check?
    d
    d
    • 3
    • 6
  • g

    gsala

    03/25/2019, 10:27 AM
    is there a built-in KTX extension for dpToPx ?
    c
    • 2
    • 1
  • j

    Jakub Blaha

    03/25/2019, 10:46 AM
    Hello there, I am making a application that resends a notification for personal purposes and I have already managed to duplicate the notification, however I cannot find a way how to duplicate the channel since my device is running android 8.1. Does anyone here know about any easy to use method/function to duplicate a channel from
    StatusBarNotification
    ?
    c
    • 2
    • 4
  • a

    Adam Kirk

    03/25/2019, 2:37 PM
    Im having trouble creating a unit test without needing robolectric. I am using AndroidThreeTen.init(this) in my code and when i run my test if I disable robolectric I get an error:
    org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered
    and if I leave it enabled I get this:
    [Robolectric] com.mycomp.,yapp.utilities.log.LogTest.on Calling function w it returns an Int: sdk=28; resources=BINARY
    I have tried using testImplementation ‘com.jakewharton.threetenabp:threetenabp:1.1.0’ made no difference. I have AndroidThreeTen.init(this) called in my application and testApplication. any ideas? this is my test
    @Test
        fun `on Calling function i it returns an Int`() {
            assertThat("Returned class is not an Int", Log.i("Test", "Test"), isA(Int::class.java))
            assertThat("Returned Int is not 0", Log.i("Test", "Test"), `is`(0))
        }
    Or do I have to use robolectric because of this? (Side note: Log is not the util.log from android but my own class) (edited)
    :stackoverflow: 1
    • 1
    • 1
  • d

    Diefferson

    03/25/2019, 4:59 PM
    @jw Whats your opinion about Flutter?
    c
    j
    +2
    • 5
    • 6
  • a

    Akash Agarwal

    03/26/2019, 4:06 PM
    @efemoney my studio was fine until last night. Do I really have to get this eap?
    m
    • 2
    • 2
  • m

    Michael Bernier

    03/26/2019, 4:07 PM
    canary 8 is broken with kotlin, some work around include uninstalling the kotlin plugin
    a
    • 2
    • 1
Powered by Linen
Title
m

Michael Bernier

03/26/2019, 4:07 PM
canary 8 is broken with kotlin, some work around include uninstalling the kotlin plugin
a

Akash Agarwal

03/26/2019, 4:10 PM
yep doing that
View count: 1