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

    jw

    01/13/2018, 1:36 AM
    malware programmers are programmers too
    👍 1
    💯 3
    k
    • 2
    • 1
  • a

    Ayden

    01/13/2018, 8:50 AM
    @jw How to check the log of
    println
    when I execute the Android?
    g
    b
    • 3
    • 2
  • a

    Ayden

    01/13/2018, 9:44 AM
    What does this line of code mean?
    g
    • 2
    • 2
  • a

    Ayden

    01/13/2018, 10:52 AM
    @gildor You can only cast if the instance/object is inheritance by it?
    g
    • 2
    • 1
  • f

    filiplamparski

    01/13/2018, 11:59 AM
    Ideally I don't want to have two IDEs open, IntelliJ CE has enough Android support already iirc
    s
    • 2
    • 1
  • g

    gildor

    01/15/2018, 3:25 AM
    Why do you want to mock String? Just give input and check output Something like
    assertEquals("HI", "hi".toUpperCase())
    assertEquals("1", "1".toUpperCase())
    It’s easy to test function without side effects. If a function has side effects you should probably refactor it to make testable. Always depends on your case
    k
    m
    o
    • 4
    • 25
  • s

    StavFX

    01/15/2018, 6:43 PM
    Hey, I'm looking at KotterKnife and it doesn't look like there's a way to unbind views once they've been initialized. Won't this causes leaks?
    k
    • 2
    • 1
  • n

    nickk

    01/16/2018, 2:39 PM
    Is there any example, how to inject an anko generated view/layout into a layout inflated from XML? I have a placeholder (
    FrameLayout
    ) in my XML layout and I want to populate it with an unknown number of `TextView`s, programmatically, at runtime. I tried something like:
    placeholder.addView(xxx)
    , where xxx is a VerticalLayout created using anko, but I am getting the Exception:
    java.lang.IllegalStateException: The specified child already has a parent
    I create the VerticalLayout with this function:
    fun createTextViews() : View {
            return verticalLayout {
                textView {
                    text = "TextView 1"
                }
    
                textView {
                    text = "TextView 2"
                }
            }
    
        }
    r
    • 2
    • 15
  • k

    Kvikende

    01/16/2018, 2:58 PM
    I am using Android Studio 3.0.1 and I was prompted to update my kotlin plugin to version "1.2.10-release-Studio3.0-1", which I did. Now nothing works because I get a "Plugin Error: Kotlin threw an uncaught AbstractMethodError." on startup. I changed to
    ext.kotlin_version = '1.2.10'
    but still I get the error. Im not sure what to do now. Any suggestions? Edit: I got a new error during this start up:
    Plugin Error: Kotlin threw an uncaught NoSuchMethodError.
    before the AbstractMethodError.
    r
    v
    • 3
    • 7
  • k

    Kyle

    01/16/2018, 3:54 PM
    Hey all, I am looking for a good guide on making a reusable drawer layout for an app I am playing with. The problem I am having is passing the specific activity DSL to the drawer layout, when I am calling my class.
    d
    • 2
    • 2
  • k

    koufa

    01/16/2018, 5:34 PM
    Hey how is this answer working. I mean he neither did declare a default constructor nor default values for the primary constructor params. https://stackoverflow.com/questions/44117970/kotlin-data-class-from-json-using-gson
    m
    • 2
    • 1
  • s

    spragg

    01/17/2018, 7:21 AM
    http://arrow-kt.io/
    ❓ 1
    :arrow: 16
    d
    • 2
    • 4
  • m

    Mathbl

    01/17/2018, 2:42 PM
    Hey all, I have an issue where I have a Parcelable object that I want to pass to an activity. Let’s say this object is a
    Conversation
    and it also contains a list of
    ConversationMembers
    . The thing is, my ConversationMember model has a
    conversationId
    property, that is declared as not null -> In the backend, it doesn’t make sense for a
    ConversationMember
    to have a null
    conversationId
    . But the thing is, the API doesn’t always send me every fields serialized (it avoids serializing useless fields depending on the situation). So I have this place where I get the
    Conversation
    (containing a list of
    conversationMembers
    ) from the backend, but the field
    conversationId
    is not present at this place for the
    conversationMembers
    . So when I try to pass this object to the activity and start it, it throws a
    java.lang.RuntimeException: Unable to start activity java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter conversationId
    How do you deal with that use case? I don’t want to mark this field as nullable, cause at the base it doesn’t make sense, but in the context of api responses with fields restricted to the minimum, the property that I mark as not null could end up being null (not present) in some context.
    m
    m
    r
    • 4
    • 17
  • g

    Greg Stepniewski

    01/17/2018, 5:09 PM
    I've just updated kotlin in my project to 1.2.20 (it used to be 1.1.51, the default for new projects in AS) - should I change my dependency from stdlib-jre7 to stdlib-jdk7 ? and should I even upgrade to Kotlin 1.2 in the first place ?
    g
    • 2
    • 1
  • j

    jw

    01/17/2018, 5:12 PM
    yes. yes. respectively.
    a
    n
    • 3
    • 2
  • k

    Kevin Janvier Chinabalire

    01/18/2018, 12:50 PM
    how are u binding the data?
    c
    • 2
    • 1
  • m

    Mathbl

    01/18/2018, 6:34 PM
    When I have a MutableList, and I want to perform an operation on it like filter, I do something like this:
    filteredMembers = members.filter { memberIds.contains(it.id) }.toMutableList()
    But I need to do toMutableList() at the end, which sort of seems wrong to me. Is it the right/only way to do?
    m
    • 2
    • 1
  • t

    themarketka

    01/18/2018, 8:54 PM
    Anyone here observed this? Seems to be limited to Samsung Galaxy S5 because f*ck developers…
    Fatal Exception: java.lang.ExceptionInInitializerError
    Caused by java.lang.ArrayStoreException: kotlin.jvm.internal.PropertyReference1Impl cannot be stored in an array of type kotlin.reflect.KProperty[]
    r
    • 2
    • 3
  • f

    filiplamparski

    01/18/2018, 9:10 PM
    Is there a dependency injection framework for Kotlin that works well with Android but also is pretty close to Spring? Dagger 2 seems to be aptly named because it makes me want to poke my eyes out >_<
    🔪 1
    r
    d
    g
    • 4
    • 8
  • w

    waqas

    01/19/2018, 10:57 AM
    By the looks of it yes, but shouldn't this be there when creating a new project from the project wizard.
    l
    • 2
    • 2
  • u

    unisaurav

    01/19/2018, 1:50 PM
    plz send me link if you have any good
    j
    • 2
    • 1
  • k

    kenkyee

    01/19/2018, 7:57 PM
    Is there a compatibility issue w/ Kotlin 1.2.20 and RoboElectric? I get this error trying to run tests in Android Studio (but it works on the command line via "gradle testXXXX"): Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.robolectric.annotation.Config.application() All tests have "@Config(constants = BuildConfig.class, sdk = 21)" Backing down to 1.2.10 and plugin 1.2.10 makes everything run properly again.
    b
    • 2
    • 2
  • a

    akritrime

    01/20/2018, 7:37 AM
    That's actually the problem. I actually don't know either android or Java and most resources starts assuming familiarity with one or both.
    a
    • 2
    • 2
  • p

    Paul Woitaschek

    01/20/2018, 10:48 PM
    I have a renamed class and dagger keeps generating a factory for the old file name and therefore destroys my build
    r
    y
    h
    • 4
    • 5
  • a

    Ayden

    01/21/2018, 12:18 PM
    Instead of creating <Button> I need to create <ImageButton> 😄
    d
    • 2
    • 1
  • e

    edwardwongtl

    01/22/2018, 9:29 AM
    Can you show the code of your custom view? Specifically the constructor
    n
    • 2
    • 1
  • f

    Faraz

    01/22/2018, 11:01 AM
    i totally agree with you.. but the emphasize here is on how we can blindly import anything without it’s context!
    e
    • 2
    • 3
  • g

    gitanshu

    01/22/2018, 7:56 PM
    I have an app that was using alpha 3 of room persistence lib. Now I am trying to move it to 1.0.0 stable but doing so breaks the kaptDebugKotlin task. The weird thing is that this starts happening with room version
    1.0.0-beta1
    and above. Works fine till
    1.0.0-alpha9-1
    . Above that, the task always fails with a whole lot of
    error: cannot find symbol
    for databinding classes. However, I can actually see those generated files in
    app/build/generated/source/kapt/prodDebug/...
    . I tried building with --stacktrace and --debug but couldn't figure out what to look for in there. Stuck on this for a few hours now. How do I figure out why kapt keeps failing even though code is being generated?
    b
    • 2
    • 1
  • g

    gitanshu

    01/22/2018, 8:34 PM
    @bachhuberdesign The whole file is pretty big and I might have to redact some stuff before posting here 😅. here are my dependencies though.
    b
    • 2
    • 4
  • g

    gitanshu

    01/22/2018, 9:02 PM
    Can't say this stacktrace seems helpful either. Both gradle console and messages view show the same thing.
    b
    g
    • 3
    • 7
Powered by Linen
Title
g

gitanshu

01/22/2018, 9:02 PM
Can't say this stacktrace seems helpful either. Both gradle console and messages view show the same thing.
b

bachhuberdesign

01/22/2018, 9:05 PM
Have you tried disabling instant run? (if you have it turned on) You can also try adding
android.enableD8=false
to your gradle.properties... was having build issues with that a few days ago. I don't know if those will help, there is nothing really specific in those stacktraces to pinpoint the issue
If that doesn't help, ask on StackOverflow
g

gitanshu

01/22/2018, 9:10 PM
Will try those options too
Thanks for trying
b

bachhuberdesign

01/22/2018, 9:10 PM
Good luck 👍
g

gildor

01/23/2018, 1:40 AM
You should get full stracktrace, there is no real reson in this log. Maybe run with
--full-stacktrace
will help
g

gitanshu

01/23/2018, 4:58 AM
Tried that. No extra data there. Still says
Compilation error. See log for more details
. The rest of the stacktrace got truncated with --full-stacktrace too. What log is this talking about?
View count: 2