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

    tateisu

    08/01/2018, 1:05 PM
    Please help. I got 'Gradle project sync failed' without error message and below logs found in idea.log
    2018-08-01 21:46:53,447 [J pool 3/7]   INFO -       ScriptTemplatesProviders - [kts] loading script definitions [org.gradle.kotlin.dsl.KotlinInitScript] using cp: C:\Users\tateisu\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4\lib\gradle-core-4.4.jar;C:\Users\tateisu\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4\lib\gradle-core-api-4.4.jar;C:\Users\tateisu\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4\lib\gradle-kotlin-dsl-0.13.1.jar;C:\Users\tateisu\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4\lib\gradle-kotlin-dsl-tooling-builders-0.13.1.jar;C:\Users\tateisu\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4\lib\gradle-kotlin-dsl-tooling-models-0.13.1.jar;C:\Users\tateisu\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4\lib\kotlin-compiler-embeddable-1.1.51.jar 
    2018-08-01 21:46:53,451 [J pool 3/7]   WARN -       ScriptTemplatesProviders - [kts] cannot load script definition class org.gradle.kotlin.dsl.KotlinInitScript 
    java.lang.ClassNotFoundException: org.gradle.kotlin.dsl.KotlinInitScript
    • 1
    • 2
  • p

    peterholak

    08/01/2018, 1:32 PM
    Are breakpoints inside inline lambdas supposed to work normally? I want to know if I'm doing something wrong, or if that's just the way things are.
    t
    t
    • 3
    • 15
  • t

    tateisu

    08/01/2018, 1:51 PM
    I'm creating nearly empty Android Studio project with minSdkVersion 10, but its gradle sync was failed. https://gist.github.com/tateisu/143ef8ba903b22556fdf0e6d3001f9a3
    t
    • 2
    • 4
  • n

    nitrog42

    08/02/2018, 8:19 AM
    AS 3.3 canary users, is there a way to upgrade the plugin to 1.2.60 ?
    j
    g
    a
    • 4
    • 19
  • u

    ubu

    08/02/2018, 9:38 AM
    Hi. When using Kotlin
    data classes
    as
    Room Entities
    , what
    val
    means in this case? Thanks.
    t
    • 2
    • 1
  • r

    rCorbellini

    08/02/2018, 2:04 PM
    I am trying to create a annotation to only allow use strings from constant but its not working, someone know what i am doing wrong?
    const val CONST = "value"
    
    @StringDef(CONST)
    @Retention(AnnotationRetention.SOURCE)
    annotation class OnlyConstantsAllowed
    
    fun getFromKey(@OnlyConstantsAllowed const : String) {
        //..
    }
    c
    • 2
    • 2
  • a

    Ayden

    08/02/2018, 2:14 PM
    Just remove the
    object: Runnable
    ?
    l
    r
    p
    • 4
    • 7
  • h

    Harun

    08/03/2018, 1:45 PM
    How do you return one value/parameter in Kotlin data class toString function when you have mutliple parameters
    a
    • 2
    • 2
  • n

    nwh

    08/04/2018, 9:13 PM
    Should I be using
    androix
    packages if I'm starting a new app?
    👍 2
    k
    g
    p
    • 4
    • 5
  • f

    fitken

    08/06/2018, 6:51 AM
    but still not work
    • 1
    • 1
  • s

    Seri

    08/06/2018, 5:40 PM
    https://android-developers.googleblog.com/2018/08/introducing-android-9-pie.html
    🥧 13
    🙌 1
    r
    • 2
    • 1
  • n

    nwh

    08/06/2018, 9:33 PM
    Is there currently an easy way to wait for (suspend) something like a permissions request (which calls
    onRequestPermissionsResult
    as a callback)?
    t
    a
    • 3
    • 3
  • t

    tateisu

    08/07/2018, 6:27 AM
    How to avoid this warning?
    l
    r
    a
    • 4
    • 3
  • f

    francis

    08/07/2018, 11:45 PM
    why do i get such an error in kotlin when i try to run my app, someone help me please
    g
    • 2
    • 1
  • j

    juliocbcotta

    08/08/2018, 3:06 AM
    So with sdk 28
    parcel.readString()
    returns a
    String?
    .. but my data class uses
    String
    .. should I just place
    !!
    to get rid of the warning?
    g
    m
    • 3
    • 3
  • j

    jw

    08/08/2018, 4:16 AM
    there's also this weird stigma around
    !!
    as something to be avoided and a sign of bad Kotlin code. This seems to come from the Java-to-Kotlin converter which usually results in a lot of
    !!
    and ugly Kotlin. But that doesn't mean there aren't valid cases where
    !!
    makes sense.
    p
    • 2
    • 1
  • t

    tiwiz

    08/08/2018, 6:57 AM
    Hello everyone, we found a strange issue migrating from Kotlin 1.2.51 to 1.2.60 (always present with AGP 3.1.3, 3.1.4, 3.2.0-beta04 and 3.2.0-beta05, and android extensions plugin):
    exception: java.lang.ClassCastException: java.util.Collections$UnmodifiableCollection cannot be cast to java.util.Set
        at org.jetbrains.kotlin.android.synthetic.AndroidComponentRegistrar.registerProjectComponents(AndroidComponentRegistrar.kt:154)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:179)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:117)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:413)
    I couldn't really find anything on the web, we tried to refactor away some problematic libraries like Guava, but no luck 😕
    g
    j
    • 3
    • 11
  • j

    juliocbcotta

    08/08/2018, 5:38 PM
    done https://youtrack.jetbrains.com/issue/KT-25988
    r
    • 2
    • 2
  • k

    kenkyee

    08/08/2018, 8:07 PM
    Ugh...you can't get the CREATOR static field of a @Parcelize'd object? That seems like a pretty big bug if you need to get arrays of objects in instance state 😛 https://youtrack.jetbrains.net/issue/KT-19853 Finally put together a repro app for the issue I hit last week and looked it up in existing issues and it's been there since 1.1.x? 😮
    r
    • 2
    • 2
  • a

    AzMoo

    08/09/2018, 2:24 AM
    Hey, is there a way I can make a PreferenceFragment extend LifecycleOwner? It wants me to implement getLifecycle but I’ve no idea how I would do that and I’m struggling to find anything relevant on google.
    :stackoverflow: 1
    t
    • 2
    • 5
  • p

    Paul Woitaschek

    08/10/2018, 8:52 AM
    I would like the compiler to throw an error if Parcelize wants to serialize
    Serializable
    classes. Is that possible? I want to enforce
    Parceler
    for every type
    l
    • 2
    • 1
  • c

    chi

    08/10/2018, 1:19 PM
    Hi here, I'm looking for a good resource on concurrency in Kotlin (RxJava and Coroutines), I found the book "Reactive programming in Kotlin" but the review on Amazon is 1/5 and the commentator said "Poorly written and edited. Many errors in the text and examples. The examples are quite convoluted which obscures the point the author is trying to make." Anyone have any experience with this book, and should I move on from this book?
    s
    r
    • 3
    • 11
  • o

    ossama

    08/12/2018, 7:34 AM
    When I try to run this code, an error of
    return is not allowed here
    is shown. I’ve read that Non-labeled return statements return from the nearest enclosing fun (ignoring lambdas). I don’t know what’s the mistake here. Could anyone help please?
    Untitled.kt
    a
    l
    g
    • 4
    • 9
  • p

    Pratham

    08/13/2018, 7:32 AM
    Does anyone knows where can I add a request for a feature for Android Room Library
    g
    a
    • 3
    • 2
  • a

    Aaron Bond

    08/13/2018, 10:59 PM
    i notice there’s still a lot of distaste for fragments, what do you guys use in place of fragments?
    m
    c
    +3
    • 6
    • 9
  • s

    STAYER

    08/14/2018, 6:22 PM
    Hi everyone! How to correctly use synthetic properties?: directly use in code or assign to an object inside fragment (activity) like this:
    -.kt
    k
    d
    • 3
    • 3
  • j

    juliocbcotta

    08/14/2018, 7:53 PM
    Does anyone know of a lib or something to easy LiveData unit testing? Maybe some extension functions... It seems odd to me having to execute an
    ld.observeForever
    method inside a unit test...
    a
    • 2
    • 1
  • r

    Ronald Daugherty

    08/15/2018, 4:03 PM
    Hello everyone, has anyone tried background listening for the Nearby API on Android 26+. I've tried WorkManager and JobIntentService and in both instances the beacon listener will not fire at all. Any suggestions?
    :stackoverflow: 6
    :google: 3
    l
    • 2
    • 1
  • k

    krtko

    08/16/2018, 11:01 PM
    I have been toying around with an idea to be able to directly pass arguments between Fragments. Could y'all let me know if its a bad idea or pointless? I would just love to find a solution that doesn't involve serial/deserialization of data into bundles. When the Fragment is first created, embed the a subclassed ViewModelProvider.Factory into the Fragment with the arguments you want to pass on. When the Fragment goes to get its ViewModel it'll use the embedded Factory which will pass on the arguments. If the factory isn't embedded it constructs a new one with default arguments. Since ViewModels survive configuration changes, the same ViewModel with the previous arguments will be used each time that Fragment gets recreated.
    j
    • 2
    • 2
  • d

    david.bilik

    08/17/2018, 10:31 AM
    Hi, i know I’ve read somewhere that you can disable generating synthetic view properties with androidExtensions but still keep Parcelize work, anyone with some reference? I cant google it 😕
    n
    a
    • 3
    • 3
Powered by Linen
Title
d

david.bilik

08/17/2018, 10:31 AM
Hi, i know I’ve read somewhere that you can disable generating synthetic view properties with androidExtensions but still keep Parcelize work, anyone with some reference? I cant google it 😕
n

no

08/17/2018, 12:41 PM
i was wondering this as well
a

ahegazy

08/17/2018, 1:32 PM
I was thinking about the same thing yesterday https://youtrack.jetbrains.com/issue/KT-23244
androidExtensions {
    experimental = true
    features = ["parcelize"]
}
d

david.bilik

08/19/2018, 7:43 PM
hm. i see that I even commented this issue 😄 i need better memory
😄 1
View count: 2