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

    jw

    10/25/2018, 9:04 PM
    The Studio default will be changed to comply soon
    👍 24
    m
    t
    • 3
    • 2
  • a

    aidanvii

    10/26/2018, 10:24 AM
    I'm having no luck attaching the kotlin stdlib sources in Android Studio 😕
    g
    • 2
    • 10
  • u

    ursus

    10/28/2018, 4:34 AM
    Has anyone thought about having "empty" foreground service, i.e. not owning object references nor thread and having the object live "separately", where it emits its state, where some other code just starts / stops the service accordingly, for androids background (foreground) sake?
    r
    s
    • 3
    • 29
  • s

    Santhosh

    10/28/2018, 3:46 PM
    is there any java android slack channel?can anyone please provide?
    🇳🇴 5
    l
    r
    o
    • 4
    • 3
  • h

    hyunghui

    10/28/2018, 4:29 PM
    Hi my android library team is considering using Kotlin for our library, now it is pure java. It is not easy to convince all team members to start using it because if we start using Kotlin, users who use our library should take care of the Kotlin version in their apps to avoid Kotlin version conflict. If there are some use cases it will be helpful. Is there any library successfully applied Kotlin?
    j
    a
    +2
    • 5
    • 7
  • s

    Soundlicious

    10/29/2018, 3:38 AM
    Anyone working with mvrx here? i'm using it with Android Navigation Component to display a view with bottomNavigation and two fragment. i would like to share an id to those two fragments, but i can't access the activity that contain them... bit lost here with that framework 😥
    s
    o
    • 3
    • 5
  • j

    joeamrhein

    10/29/2018, 4:07 PM
    Is there a different way of specifying the following in Kotlin 1.3? I'm getting
    This annotation is not applicable to target 'undefined target' and use site target '@param'
    errors now
    private fun foo(map: Map<String, @param:RawRes Int>) {}
    u
    p
    • 3
    • 6
  • a

    adam-mcneilly

    10/29/2018, 5:46 PM
    I notice sometimes when people use libraries that have annotation processing like Room, they have both
    kapt "..."
    and
    annotationProcessor "..."
    . What is the reason for needing both?
    p
    • 2
    • 1
  • j

    jw

    10/29/2018, 8:00 PM
    allprojects {
      tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
          freeCompilerArgs += [
              '-progressive'
          ]
        }
      }
    }
    in root
    build.gradle
    👍 3
    d
    o
    • 3
    • 3
  • s

    skennedy

    10/29/2018, 8:25 PM
    you shouldn’t need any special configuration for kotlin
    t
    • 2
    • 5
  • b

    blyn

    10/29/2018, 8:49 PM
    AS is yelling at me after Kotlin 1.3, i’m assuming due to the new contracts:
    private fun foo(value: String?) {
            var myString: String = ""
    
            if (!value.isNullOrEmpty()) {
                myString = value
            }
        }
    IDE complains that there’s a type mismatch between
    myString
    and
    value
    , but the compile builds no problem (and warns if i explicitly
    !!
    ). Is there anyway around this?
    o
    s
    +2
    • 5
    • 8
  • t

    tonyng93

    10/30/2018, 4:36 AM
    Hey guys, is
    kotlin-gradle-plugin:1.2.71
    not compatible with
    android-studio-3.4-canary-2
    normal? Anyone facing the same issue?
    a
    • 2
    • 1
  • t

    tigran.babajanyan

    10/30/2018, 8:41 AM
    Hi all, how to implement coroutines UI and bg in kotlin 1.3?
    👎 2
    g
    • 2
    • 2
  • z

    Zaidi

    10/30/2018, 9:33 AM
    if there any one who can read this article and suggest me is this the best approach to implement this https://medium.com/@skydoves/how-to-manage-sharedpreferences-on-android-project-5e6d5e28fee6
    g
    l
    p
    • 4
    • 9
  • y

    yperess

    10/30/2018, 1:45 PM
    Is there a way to use the new Kotlin contracts along with an API check? For example, I want to turn the following:
    if (Build.VERSION.SDK_INT >= 23) {
        // Long code block
    } else {
        throw IllegalAccessException()
    }
    Into:
    if (Build.VERSION.SDK_INT < 23) throw IllegalAccessException()
    // Long code block
    g
    l
    • 3
    • 5
  • i

    ivano

    10/30/2018, 4:43 PM
    Are you familiar with mockk? I added in build.gradle:
    testImplementation "io.mockk:mockk:1.8.9"
    the sync works smooth, with no error messages,but if I try to write `val class =mockk<ClassWhatever> `I get an unresolved reference, the library is present, I have also tried to install apart Mockito, but does not work
    g
    • 2
    • 1
  • r

    robinchew

    10/30/2018, 4:49 PM
    message has been deleted
    s
    • 2
    • 3
  • n

    nick

    10/30/2018, 8:33 PM
    Is anyone else having trouble with android data-bindings with kotlin 1.3? I’m getting the following compile error:
    * What went wrong:
    Could not resolve all files for configuration ':myProject:debugAnnotationProcessorClasspath'.
    > Could not find org.jetbrains.kotlin:kotlin-stdlib-jre8:1.3.0.
      Searched in the following locations:
        - <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.pom>
        - <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.jar>
        - <https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.pom>
        - <https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.jar>
        - <https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.pom>
        - <https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.jar>
        - <https://appboy.github.io/appboy-android-sdk/sdk/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.pom>
        - <https://appboy.github.io/appboy-android-sdk/sdk/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.jar>
        - <https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.pom>
        - <https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.3.0/kotlin-stdlib-jre8-1.3.0.jar>
      Required by:
          project :myProject > com.android.databinding:compiler:3.1.4
          project :myProject > com.android.databinding:compiler:3.1.4 > com.android.databinding:compilerCommon:3.1.4
    g
    • 2
    • 2
  • j

    jw

    10/30/2018, 8:54 PM
    Also if you use Dagger with Kotlin, modularization will yield 10x performance improvements than incremental annotation processing (through granular local caching, higher hits on remote caching, compilation avoidance, stronger encapsulation, and parallelization)
    👍 13
    j
    • 2
    • 2
  • d

    darkmoon_uk

    10/30/2018, 9:06 PM
    As a side note: the one development that is taking our local build time from 15 minutes down to 5 minutes (yes, really), is the V2 DataBinding compiler. See: https://www.reddit.com/r/androiddev/comments/9nru7j/data_binding_compiler_v2_in_android_studio_321/
    g
    u
    • 3
    • 7
  • j

    Jakub

    10/31/2018, 9:15 PM
    Could you recommend me an open source project written in
    Kotlin
    that shows the best practices and implements authentication using
    OkHttp Authenticator
    ,
    Retrofit
    , keeps
    RefreshToken
    in
    KeyStore
    and in general has well organised structure for the whole network layer?
    y
    b
    i
    • 4
    • 4
  • t

    tuan.lam

    11/01/2018, 9:10 AM
    Hi everyone, I have a problem, pls help to clear it. How multi coroutines work in cpu?
    🙂 2
    :google: 4
    g
    • 2
    • 1
  • j

    Jakub

    11/01/2018, 5:55 PM
    Sorry for the offtopic, but is there a place on the web where I can ask for the best practices for Android development?
    l
    f
    j
    • 4
    • 9
  • j

    Jakub

    11/01/2018, 5:55 PM
    *Not only Kotlin
    l
    z
    • 3
    • 3
  • i

    igor.wojda

    11/02/2018, 1:58 AM
    How to enable
    Data Binding
    in Gradle Kotlin Script? Below config works perfectly for build.gradle (groovy), but results in
    cannot access enabled: it is private in DataBingingOptions
    error in build.gradle.kts (Kotlin Gradle Script)
    android {
        ...
        dataBinding {
            enabled = true
        }
    }
    g
    • 2
    • 3
  • m

    Mark

    11/02/2018, 5:38 AM
    Is there some sample code out there for a recyclerview adapter using
    produce{}
    (coroutines)
    g
    m
    • 3
    • 50
  • b

    BMG

    11/02/2018, 8:49 AM
    I’m using Kotlin stdlib 1.3.0 and Kotlin Compiler 1.3. But still android studio IDE showing errors if I use anything above Kotlin 1.1 API like
    rem()
    . But gradle builds are working fine. What could be wrong here?
    g
    j
    • 3
    • 3
  • s

    Shashank Gupta

    11/02/2018, 9:10 AM
    Hi Guys, I have a query regarding multi-threading in Kotlin. I have 3 streams and am combining them like this, A.withLatestFrom(B, C, { a, b, c -> }).subscribe { } where, A, B, C are PublishSubjects Operations perform inside subscribe { } are: - Accessing Database and fetch data - Process that data and create the list - This list is then pushed to Adapter to display the list Need: I want to run the operation in 2nd thread and finally push the list to main Thread Solutions tried: - used subscribeOn(Schedulers.computation) and observeOn(AndroidSchedulers.mainThread) - used hide() Please help!!!
    e
    • 2
    • 6
  • t

    Tolriq

    11/02/2018, 10:03 AM
    Yes but to be sure
    Job() + Dispatchers.Main
    create a new context and parent job? (The Android lifecycle part I master after all those years:p) and calling coroutineContext.Cancel() does cancel the parentJob and all the child + prevent new calls, and that coroutineContext.CancelChildren() only cancel running jobs for that context/job and allows queuing new ones?
    l
    g
    • 3
    • 23
  • s

    Sergio Crespo Toubes

    11/02/2018, 1:52 PM
    @louiscad what are you using? anko for build the views?
    🥁 1
    l
    m
    • 3
    • 10
Powered by Linen
Title
s

Sergio Crespo Toubes

11/02/2018, 1:52 PM
@louiscad what are you using? anko for build the views?
🥁 1
l

louiscad

11/02/2018, 2:09 PM
An alternative to anko. I'm still working on a breaking release right now (after months of work), so I'll ping you with the link after it's done (hopefully, finally today)
s

Sergio Crespo Toubes

11/02/2018, 3:38 PM
ok thanks you
m

Matt Rea

11/02/2018, 6:09 PM
there’s nothing wrong with using
findViewById
. Synthetic imports from xml just give you view caching. Not a huge benefit for most apps
➕ 1
you could also build a lazy delegate wrapper around
findViewById
pretty easily
so you could do
val view: View by viewFinder(R.id.view)
l

louiscad

11/02/2018, 6:11 PM
@Matt Rea I don't see the link with this specific thread, we're not talking about findViewById but Views without xml at all here
@Matt Rea Maybe you targeted the message just above the one that started this thread?
m

Matt Rea

11/02/2018, 6:12 PM
oooo I misunderstood what you were saying about ’moving away from xml`. Thought you were talking about moving away from synthetic imports, not xml altogether
nice! Interested to see your work when its finished
l

louiscad

11/02/2018, 10:57 PM
The alpha5 version of Splitties is now available on jcenter and is on the master branch on GitHub. I'm still writing the release notes, but you probably only need the updated documentation. So, to make UIs in Android, I use the View DSL split, and you can read the documentation and try it by following this link: https://github.com/LouisCAD/Splitties/blob/master/viewdsl/README.md There are not much examples at the moment (because I also have a day job), but the API and the doc is there.
:kotlin: 1
:kotlin-flag: 1
View count: 1