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

    Saiedmomen

    01/30/2019, 7:15 AM
    In Intellij I turned on "delegate IDE build/run actions to gradle" and it works 70% of the times. But this option is not there in Android Studio. Is there another work around?
    g
    • 2
    • 4
  • h

    Hadi Tok

    01/30/2019, 8:12 AM
    I saw this on reddit. I didn’t know kotlinx synthetic is no longer recommended practice. Does anyone know why it is no longer recomended? https://android-review.googlesource.com/c/platform/frameworks/support/+/882241
    🤔 4
    👎 1
    🧐 1
    a
    e
    +5
    • 8
    • 17
  • b

    Brian Mahecha

    01/30/2019, 11:48 AM
    Morning everyone! How's everyone's experience with Anko been for Android development? Been thinking of starting a project using Anko. Thanks everyone!
    g
    k
    +2
    • 5
    • 7
  • n

    Nir Golan

    01/30/2019, 12:28 PM
    hi guys, i'm using FragmentStatePagerAdapter and everytime the app goes to background i see in onSaveInstanceState the fragments in it, the problem is that every time i go to background i get them added again (4-8-12) and after 12 i get TransactionTooLargeException, can anyone help?
    :stackoverflow: 4
    d
    r
    • 3
    • 3
  • l

    locke

    01/31/2019, 3:05 AM
    Does anyone know what could possibly cause:
    2019-01-30 22:03:38.844 29960-30028/? W/PackageManager: Failure retrieving text 0x7f0e001b in package com.example.voxcaster
        android.content.res.Resources$NotFoundException: String resource ID #0x7f0e001b
            at android.content.res.Resources.getText(Resources.java:348)
            at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:1678)
            at android.content.pm.PackageItemInfo.loadUnsafeLabel(PackageItemInfo.java:204)
            at android.content.pm.PackageItemInfo.loadLabel(PackageItemInfo.java:194)
            at com.google.android.finsky.verifier.impl.ew.d(SourceFile:499)
            at com.google.android.finsky.verifier.impl.ew.u(SourceFile:365)
            at com.google.android.finsky.verifier.impl.ew.a(SourceFile:100)
            at com.google.android.finsky.verifier.impl.go.a(SourceFile:109)
            at com.google.android.finsky.verifier.impl.b.e.a(SourceFile:2)
            at com.google.android.finsky.verifier.impl.b.e.doInBackground(SourceFile:6)
            at android.os.AsyncTask$2.call(AsyncTask.java:333)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
            at java.lang.Thread.run(Thread.java:764)
    The app is building and installing just fine, but then at runtime the package manager can't find the string resource for the app name? I am very lost as to what could cause that.
    g
    • 2
    • 2
  • n

    nerdstone

    01/31/2019, 8:51 AM
    Hi, how do you debug RxKotlin? Especially when working with Schedulers that run on a separate thread and is observed on the main thread?
    :stackoverflow: 2
    g
    • 2
    • 4
  • a

    Animesh

    01/31/2019, 11:31 AM
    Hi, I am getting following issue in unit testing with mokito
    java.lang.IllegalStateException: MyApplication.getInstance() must not be null
    here is my function code snipped
    fun Favoritable.isFavorite() : Boolean {
       val user = MyApplication.getInstance().loginManager.loggedInUser
       return isFavorite(user)
    }
    :stackoverflow: 3
    r
    k
    • 3
    • 3
  • s

    spierce7

    01/31/2019, 6:31 PM
    Is it safe to store the Android Application Context in a static variable? Every time I make a library that does this, I get a warning that it's not safe, causes memory leaks, and would break instant run. As long as this is done with an Application Context, I can't think of a reason this wouldn't be ok. Can anyone argue otherwise?
    :stackoverflow: 2
    v
    i
    +3
    • 6
    • 12
  • o

    Owen Carpenter

    02/01/2019, 2:29 AM
    Does anyone know the proper way to programmatically set the pressed state of an image button? I want to press an image button that will create an api call and then stay in a pressed state until receiving the response will take a few seconds. .setPressed from the Android View documentation does not seem to work and the code below does not work
    :stackoverflow: 2
    a
    d
    • 3
    • 5
  • o

    Owen Carpenter

    02/01/2019, 2:29 AM
    private fun postData(resource: String, request: Model.Request, view: ImageButton){
            view.setPressed(true)
            disposable = apiService.postData(resource, request)
                    .subscribeOn(<http://Schedulers.io|Schedulers.io>())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(
                            { r -> view.setPressed(false)
                                toast("Success")},
                            { e -> toast("Error")}
                    )
    
        }
    m
    • 2
    • 1
  • n

    neuber

    02/02/2019, 12:32 AM
    Hi, I need help with this (pls
    d
    • 2
    • 1
  • g

    ghedeon

    02/02/2019, 2:40 PM
    Can we ban this bot or whatever it is 🙂?
    🤔 1
    n
    r
    +2
    • 5
    • 7
  • e

    egek

    02/02/2019, 3:16 PM
    I saw something like this today ```val TAG by lazy “ExampleClassTag”```basically he is lazy loading the tag he uses in Log.d, what’s the point of this?
    n
    • 2
    • 1
  • v

    Viktor Vostrikov

    02/02/2019, 8:32 PM
    Hello, should I be replacing RxJava for coroutines? I need to decrease size of the library, because RxJava takes a lot of space in the Android project... I have written a detailed question in Android Reddit subreddit ( really great community there) https://www.reddit.com/r/androiddev/comments/amfy3f/should_i_switch_rxjava_for_kotlin_coroutines/?utm_source=reddit-android
    g
    r
    +3
    • 6
    • 9
  • b

    Brian Mahecha

    02/04/2019, 2:54 PM
    Morning everyone! Anyone else having issues with their Anko plugin for Android Studio? Keep getting
    java.lang.IllegalArgumentException: argument type mismatch
    Whenever I click the Anko Preview tab. Thanks everyone! (edited). Plugin version:
    0.10.7-2
    and Anko version:
    0.10.8
    Android-Studio version:
    3.3
    l
    • 2
    • 4
  • f

    fradiati

    02/05/2019, 7:22 AM
    rxjava
    s
    • 2
    • 1
  • o

    Oleh Ponomarenko

    02/05/2019, 2:50 PM
    Hello guys! What is the better dispatcher in coroutines for background broadcasting some data via Bluetooth? I use "Dispatchers.IO". Is it ok? I've already read this page -https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/ I just need your advice)
    t
    f
    • 3
    • 4
  • t

    tenprint

    02/05/2019, 9:16 PM
    Those of you using sealed classes to wrap state, how are you persisting them? (e.g. onSaveInstanceState/onRestoreInstanceState) @alostpacket
    g
    t
    • 3
    • 7
  • d

    dave

    02/06/2019, 8:46 AM
    hallo guys, have any of you used Android Architecture Components? Would you advice to use it? What's the most commonly used architecture in Android nowadays?
    g
    r
    +4
    • 7
    • 16
  • w

    Wouter Vegter

    02/07/2019, 2:32 PM
    Situation: I have a crash popping up in my crashlytics, where a JobCancellationException is thrown, that has no usable stackstrace. Idea: Now I like to write a specific catch mechanism via Thread.setUncaughtExceptionHandler, so that I can inspect different properties of this JobCancellationException, and add it to the crashlytics crash report. I have tried quite some variations to force a JobCancellationException, but none of them have succeeded. Question: Does anyone know a small android-kotlin codesample that will for sure throw a JobCancellationException? Thanks for reading this!
    a
    • 2
    • 3
  • b

    bryan

    02/07/2019, 6:40 PM
    Is it safe to call `requireContext()`/`requireActivity()` in a
    LiveData
    observer?
    n
    t
    • 3
    • 3
  • d

    dewildte

    02/07/2019, 11:32 PM
    I got the debugger to break on the stable Android Studio version 3.3.1. So there is something definitely wrong with the current Canary.
    g
    • 2
    • 3
  • o

    oday

    02/08/2019, 2:15 PM
    no way in hell to get that shortcut to work unless the Run menu is physically open when you press it
    d
    s
    • 3
    • 12
  • e

    emma

    02/08/2019, 5:03 PM
    we have over 100 gradle modules and it's really taking a toll on our build times, it affects incrementals too
    😕 3
    j
    g
    • 3
    • 6
  • d

    Davide Giuseppe Farella

    02/09/2019, 4:39 AM
    Could a
    sealed class
    be a good option for an abstract
    Fragment
    ?
    sealed class BaseFragment: Fragment()
    
    abstract class RootFragment: BaseFragment()
    abstract class NestedFragment: BaseFragment()
    g
    r
    • 3
    • 16
  • m

    mvbrenes

    02/10/2019, 10:14 PM
    For a while now trying to use the latest version (2.1.0)
    Mockito-Kotlin
    has been a pain if you are using the Android
    Jetitfier
    . The library relies on a version of Mockito which has an updated version (1.9.0) of
    Byte-buddy
    who is the real culprit here. I was able to resolve this by adding:
    android.jetifier.blacklist=byte-buddy
    to my
    gradle.properties
    file, now i can happily move on without forcing certain versions of Mockito or excluding libraries which gets kind of hairy when you have a lot of modules and dependencies. Posting this here in case if helps anyone else 🙂
    👍 4
    a
    j
    p
    • 4
    • 8
  • l

    LeoColman

    02/11/2019, 10:26 AM
    I'd sugest using #mockk instead of mockito-kotlin
    ➕ 3
    g
    • 2
    • 6
  • n

    Norbert Flas

    02/11/2019, 12:18 PM
    Hi I have a problem in android studio,First I have a gradle problem "ERROR: Cause: invalid type code: 68" I try everything whats is in the internet gradle update reinstall android studio and jdk, but only dissable option "Only sync the active variant" "works" after that it's showing to me (look at the picture) with statement "Error: Kotlin: Unsupported plugin option: org.jetbrains.kotlin.android:enabled=true" I updated kotlin plugin and restart android studio and its not working. Please help me 😞
    m
    a
    g
    • 4
    • 5
  • s

    Shane Blackburn

    02/11/2019, 8:52 PM
    Hi all! I created a Kotlin file in my project that is a data class that colds an array of questions and answers. I can't figure out how to access that array in my main activity! Any ideas? Thanks!
    s
    t
    d
    • 4
    • 4
  • l

    landoulsi

    02/12/2019, 7:48 AM
    Hey guys, I have a problem: after I migrated to the new multiplatform plugin, I am not able to use
    Mockk
    library on the common module:
    MyTest.kt: (74, 9): Unresolved reference: every
    , does any one can help with this ?
    a
    • 2
    • 1
Powered by Linen
Title
l

landoulsi

02/12/2019, 7:48 AM
Hey guys, I have a problem: after I migrated to the new multiplatform plugin, I am not able to use
Mockk
library on the common module:
MyTest.kt: (74, 9): Unresolved reference: every
, does any one can help with this ?
a

ahmedre

02/14/2019, 1:56 PM
there are 2 different mockk dependencies - one for Android and one for multiplatform. make sure you’re including the right one.
View count: 2