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

    Nelson Almendra

    09/23/2018, 3:14 PM
    The workaround I did was to store the list in a variable and then set it in
    onCreateView
    but it's very elegant I think
    r
    a
    s
    • 4
    • 69
  • l

    lazexe

    09/24/2018, 9:33 AM
    Should be:
    @Dao
    interface BottomBarIconDao {
    
        @Query("SELECT * FROM icons")
        fun getAll(): List<BottomBarIcon>
    
        @Query("DELETE FROM icons")
        fun deleteAll()
    
        @Insert
        fun insertAll(vararg icons: BottomBarIcon)
    }
    n
    • 2
    • 2
  • v

    Vinicius Carvalho

    09/24/2018, 1:53 PM
    Hi all, I'm still struggling to get coroutines and http to play nice with android, Is it correct to assume that
    launch
    should happen at the UI context if we need to update any component from the UI, and any networking call should happen on a
    CommonPool
    context?
    g
    s
    • 3
    • 17
  • v

    Vinicius Carvalho

    09/24/2018, 1:53 PM
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:180)
                          at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:124)
                          at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:366)
                          at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)
                          at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:492)
                          at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:470)
                          at com.microsoft.projectoxford.face.rest.WebServiceRequest.get(WebServiceRequest.java:102)
                          at com.microsoft.projectoxford.face.rest.WebServiceRequest.request(WebServiceRequest.java:78)
                          at com.microsoft.projectoxford.face.FaceServiceRestClient.listPersons(FaceServiceRestClient.java:605)
                          at com.microsoft.projectoxford.face.FaceServiceRestClient.listPersons(FaceServiceRestClient.java:623)
                          at io.igx.lego.MainActivity$onCreate$1$1.doResume(MainActivity.kt:54)
                          at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:42)
                          at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:149)
                          at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:13)
                          at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
                          at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:285)
                          at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1152)
                          at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1990)
                          at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1938)
                          at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    g
    • 2
    • 2
  • v

    Vinicius Carvalho

    09/24/2018, 1:54 PM
    cameraSource.takePicture({}, { bytes -> detectFaces(bytes) })
    fun detectFaces(bytes: ByteArray) {
                launch(CommonPool) {
    
                        val faces = facesClient.detect(bytes.inputStream(), true, false, arrayOf(FaceServiceClient.FaceAttributeType.Age))
                        val results = facesClient.identity("family", faces.map { it.faceId }.toTypedArray(), 4)
                        results.forEach { r ->
                            val name = personMap[r.candidates[0].personId.toString()]
                            Log.i(TAG,"Found $name")
                        }
    
                }
            }
    g
    • 2
    • 48
  • d

    Daniel

    09/25/2018, 9:13 AM
    Might be kotlin related: In Android Studio 3.2 running all kotlin unit tests results in an empty test suite when run for the first time after a code change. The second run finds those tests. Does anybody experienced this too?
    q
    • 2
    • 2
  • j

    jurajsolarml

    09/25/2018, 10:41 AM
    Hello, I'm a beginner. I've upgraded the AS to 3.2.Kotlin 1.2.71. API 28 and I report an error: No cached version of com.android.tools.build:aapt2:3.2.0-4818971 available for offline mode. Where can be a mistake? Thank you
    g
    • 2
    • 3
  • m

    morozov

    09/25/2018, 12:00 PM
    Who can help with implementation of
    glide
    ? Right now i get next error in my logs:
    Load failed for <https://upload.wikimedia.org/wikipedia/sco/7/71/Pringles.svg> with size [65x66]
             class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    :stackoverflow: 2
    s
    • 2
    • 13
  • l

    LG

    09/25/2018, 2:18 PM
    Did anyone done the update ? Few friends got some troubles 😬
    v
    • 2
    • 1
  • k

    kenkyee

    09/25/2018, 3:27 PM
    Android Studio 3.2 works fine...be sure to use Kotlin 1.2.71 (avoid .70) or below
    s
    d
    • 3
    • 4
  • d

    dan.the.man

    09/25/2018, 5:12 PM
    So updating from Kotlin 1.2.60 to 1.2.71, I have a Java class that implements a Java Interface but I'm getting
    e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
    For my java class, but if I downgrade to 1.2.60 I'm not seeing this error. Anyone seen something like this?
    o
    • 2
    • 1
  • v

    veer

    09/26/2018, 12:03 PM
    Hi All, am getting the below error when trying to add databinding with kotlin in my project, :app:transformDataBindingWithDataBindingMergeArtifactsForDebug :app:kaptDebugKotlin FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:app:kaptDebugKotlin’.
    There was a failure while executing work items
    > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution > java.lang.reflect.InvocationTargetException (no error message) Note: am trying to enable dataBindind for kotlin in a legacy code which already has Databinding using java, have applied apply plugin: ‘kotlin-kapt’ kapt “com.android.databinding:compiler:3.1.4” please help
    • 1
    • 1
  • r

    rkeazor

    09/26/2018, 4:22 PM
    @ribesg you have to make sure you remove all reference of the support library In your XML. Also if you 3 party dependencies, that use android support, it at times creates a conflict
    r
    • 2
    • 1
  • m

    matt tighe

    09/26/2018, 6:05 PM
    slightly off-topic, but i accidentally turned on editor type annotations in android studio as was hoping someone could tell me how to turn them back off
    g
    • 2
    • 1
  • h

    Hong

    09/26/2018, 7:00 PM
    The question is what features do you use from Realm?
    v
    b
    g
    • 4
    • 13
  • j

    jurajsolarml

    09/27/2018, 7:19 AM
    Hello,please help.I have new a bug.I've upgraded the AS to 3.2.Kotlin 1.2.71. API 28.How can I fix it? Thanks Gradle DSL method not found: 'compileSdkVersion()' Possible causes:<ul><li>The project 'Old_error_cardview' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Upgrade plugin to version 3.2.0 and sync project</li><li>The project 'Old_error_cardview' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin. Apply Gradle plugin</li>
    l
    g
    • 3
    • 8
  • t

    Tsvetozar Bonev

    09/27/2018, 7:55 AM
    Does #tornadofx work on android and will I be able to keep one code base for both desktop and android with it?
    g
    • 2
    • 1
  • r

    ribesg

    09/27/2018, 11:17 AM
    Which version of the Kotlin stdlib are you supposed to use for Android?
    k
    • 2
    • 1
  • v

    voddan

    09/27/2018, 12:40 PM
    Hello! I started getting
    Cannot change dependencies of configuration ':app:debugCompile' after it has been included in dependency resolution
    after I added kotlin serialization. It goes away if I comment out
    apply plugin: 'com.google.gms.google-services'
    . What can it be?
    k
    • 2
    • 10
  • a

    Allan Wang

    09/27/2018, 1:50 PM
    For an activity I have, I want to clean up some files upon on destroy. Would it be better to keep that in a service, or would using coroutines be good enough? The task should be independent of the activity lifecycle, and does not depend on context.
    s
    • 2
    • 5
  • j

    jurajsolarml

    09/27/2018, 3:54 PM
    Hello. I have bugs.. Please help. Thanks https://hastebin.com/uhafilazuq.bash startup failed: build file 'D:\Workspace\ZALOHA\Old_error_cardview\app\build.gradle': 8: only id(String) method calls allowed in plugins {} script block See https://docs.gradle.org/4.10.2/userguide/plugins.html#sec:plugins_block for information on the plugins {} block @ line 8, column 5. android { ^ 1 error Open File
    r
    c
    • 3
    • 14
  • n

    neuber

    09/27/2018, 7:20 PM
    Hi, Can anyone help?
    :stackoverflow: 4
    c
    d
    +3
    • 6
    • 13
  • a

    Allan Wang

    09/27/2018, 11:45 PM
    Is there no way to suppress the following error?
    Enum entry name '_****' should start with an uppercase letter
    I tried
    @Suppress("ALL")
    for both the name and the entire enum class
    g
    • 2
    • 5
  • l

    lawlorslaw

    09/28/2018, 2:54 AM
    I created an extension function for rxjava2's Observable class. How do you invoke an extension function from Java code?
    m
    • 2
    • 10
  • m

    muralimohan962

    09/28/2018, 7:10 AM
    Is there any material theme editor for android?
    g
    • 2
    • 3
  • t

    Tudor Luca

    09/28/2018, 8:42 PM
    I started a new feature with it 🤷‍♂️🏻🤞😅
    s
    j
    • 3
    • 5
  • s

    sfloamfw

    09/28/2018, 10:28 PM
    Hi All, I am trying to use kotlin2js in Android Studio. I currently have in my project’s build.gradle:
    apply plugin: 'kotlin2js'
    
    compileKotlin2Js {
            kotlinOptions.outputFile = "${projectDir}/build/js/module.js"
            kotlinOptions.moduleKind = "umd"
            kotlinOptions.sourceMap = true
        }
    as well as other configurations. When I compile my project, I do not see any .js files generated. Does anyone have any ideas as to why?
    o
    • 2
    • 2
  • m

    muralimohan962

    09/29/2018, 12:55 PM
    The ui designer is not working. Is there any problem with my dependencies?
    :stackoverflow: 2
    :google: 2
    m
    • 2
    • 2
  • n

    neuber

    09/29/2018, 5:03 PM
    I stay trying my project based on this: http://nilhcem.com/android-things/arduino-as-an-i2c-slave
    v
    • 2
    • 14
  • i

    Icaro Temponi

    09/30/2018, 3:49 PM
    Hi everyone, just would like to ask which one is better to use when inside a Coroutine Context in a background Pool to run an operation on the UI Thead: Handler(Looper.getMainLooper()).post{ /* running on UI here */ } or launch(UI) { /* running on UI here */ } I'm maintaining a library with a lot of calls to the UI and don't know which to choose
    g
    • 2
    • 7
Powered by Linen
Title
i

Icaro Temponi

09/30/2018, 3:49 PM
Hi everyone, just would like to ask which one is better to use when inside a Coroutine Context in a background Pool to run an operation on the UI Thead: Handler(Looper.getMainLooper()).post{ /* running on UI here */ } or launch(UI) { /* running on UI here */ } I'm maintaining a library with a lot of calls to the UI and don't know which to choose
g

gildor

09/30/2018, 4:10 PM
Sure, use coroutine dispatcher
But UI is deprecated, use Dispatchers.Main Also, probably you don't need
launch
, just
withContext
, but it depends on your case
i

Icaro Temponi

09/30/2018, 4:12 PM
I see, thx, i'll start to use it 🙂
Is it safe to swap all my Handler post usages to Main dispatcher? I'm wanting to use it as a standard
g

gildor

09/30/2018, 11:17 PM
Should be safe, I don’t see any potential issues. But if you have some problems with it just report an issue
i

Icaro Temponi

10/01/2018, 2:57 AM
Ok, thx, I started to use only coroutines dispatchers everywhere and they are doing really well, coroutines are really awesome.
g

gildor

10/01/2018, 3:35 AM
@Icaro Temponi Just in case, if didn’t read “Coroutines Guide to UI programming” yet, I highly recommend to do that: https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md
View count: 1