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
compose
  • c

    Colton Idle

    02/10/2021, 8:27 PM
    Is it possible to go from a Color to a hex value? i.e. I have some colors defined, but I want to print out the hex value on top of the color for debugging so it would be nice to just be able to reference the Color and get the hex value.
    a
    c
    z
    • 4
    • 8
  • v

    Vsevolod Ganin

    02/10/2021, 8:56 PM
    Am I correct that
    DisposableEffect
    and
    LaunchedEffect
    are essentially the same except that they use different methods to make the same thing: `DisposableEffect`’s block is blocking and disposes stuff with
    onDispose
    and `LaunchedEffect`’s block is suspending and disposes stuff with
    scope.cancel()
    ?
    d
    a
    • 3
    • 5
  • a

    Arkadii Ivanov

    02/10/2021, 9:58 PM
    I'm trying to update to Compose
    alpha12
    , the
    setContent
    is now deprecated, so I added
    androidx.activity:activity-compose:1.3.0-alpha01
    to the dependencies and updated the import. The build fails with the following error. Is there a fix for this?
    Task :sample:counter:app-android:compileDebugKotlin FAILED
    w: Flag is not supported by this version of the compiler: -Xallow-jvm-ir-dependencies
    w: ATTENTION!
    This build uses unsafe internal compiler arguments:
    
    -XXLanguage:+NonParenthesizedAnnotationsOnFunctionalTypes
    
    This mode is not recommended for production use,
    as no stability/compatibility guarantees are given on
    compiler or generated code. Use it at your own risk!
    
    e: Classes compiled by an unstable version of the Kotlin compiler were found in dependencies. Remove them from the classpath or use '-Xallow-unstable-dependencies' to suppress errors
    e: /home/aivanov/dev/workspace/Decompose/sample/counter/app-android/src/main/java/com/arkivanov/counter/app/MainActivity.kt: (39, 9): Class 'androidx.activity.compose.ComponentActivityKt' is compiled by an unstable version of the Kotlin compiler and cannot be loaded by this compiler
    b
    • 2
    • 3
  • i

    Ian Lake

    02/10/2021, 10:01 PM
    That's related to the issue that Chris just linked above: https://issuetracker.google.com/179911234
    ❤️ 1
    a
    • 2
    • 1
  • k

    Kyant

    02/11/2021, 1:46 AM
    I use
    mutableStateListOf().parallelStream().forEach {}
    and coroutines to execute the items in parallel, but it seems some executions won't be run. And the missing executions are random. Is there a solution?
    a
    z
    • 3
    • 11
  • d

    darkmoon_uk

    02/11/2021, 1:51 AM
    ⚠️ Should I be worried about the warnings in image below? 👇 I'm seeing a lot of it after upgrading to
    1.4.30
    / Compose
    alpha12
    , and setting:
    kotlinOptions {
                jvmTarget = "15"
                ...
    ...which appears necessary to use the new IR compiler in
    1.4.30
    j
    • 2
    • 1
  • d

    darkmoon_uk

    02/11/2021, 2:28 AM
    ⚠️ Another issue; compiler advises to switch to using
    androidx.lifecycle:lifecycle-viewmodel.compose:1.0.0-alpha01
    but that package isn't published.
    i
    • 2
    • 3
  • d

    darkmoon_uk

    02/11/2021, 7:31 AM
    Getting this error in Compose `alpha12`:
    java.lang.IllegalArgumentException: offset(4) is out of bounds [0, 3]
            at androidx.compose.ui.text.MultiParagraph.requireIndexInRangeInclusiveEnd(MultiParagraph.kt:588)
            at androidx.compose.ui.text.MultiParagraph.getCursorRect(MultiParagraph.kt:437)
    ...full trace in thread. This occurs after typing a few chars into the text-box. Bit hard to provide our code, but can say we are using a visual transformation which I suppose may affect cursor position / character indexing.
    a
    a
    • 3
    • 4
  • r

    Rafs

    02/11/2021, 8:06 AM
    After upgrading compose and Kotlin version to 
    1.4.30
     it seems my android studio is confused. Project is building and running though.
    ➕ 8
    d
    k
    +2
    • 5
    • 9
  • r

    rsktash

    02/11/2021, 10:20 AM
    Hi anybody tried new sealed interface ? I’m having issue. A.S is not recognizing this type of interface
    l
    b
    • 3
    • 6
  • b

    BenjO

    02/11/2021, 10:53 AM
    I'm upgrading to compose
    alpha12
    . Last warning I have is
    Flag is not supported by this version of the compiler: -Xallow-jvm-ir-dependencies
    . Does anyone know why ? 🙏
    j
    k
    a
    • 4
    • 22
  • v

    Vsevolod Ganin

    02/11/2021, 11:17 AM
    I think
    PointerInputScope.detectDragGestures
    is missing
    onDragStart
    callback.
    DragObserver
    had it and now it is deprecated in favor of
    PointerInputScope.detectDragGestures
    . I could workaround this with boolean but it is quite inconvenient. Maybe another way?
    m
    • 2
    • 2
  • v

    Vsevolod Ganin

    02/11/2021, 12:00 PM
    How can I use
    FlingConfig
    with new
    animateDecay
    ? Can’t see where to apply
    FlingConfig::adjustTarget
    m
    • 2
    • 3
  • d

    Denis

    02/11/2021, 12:01 PM
    No compilation errors but AS Canary 5 shows this error after upgrade to Compose alpha12.
    🤔 1
    😒ame: 1
    j
    • 2
    • 1
  • t

    Tlaster

    02/11/2021, 12:22 PM
    Is it a bug at Animatable.kt#173 since
    clampedValue
    is the actual result but never being used
    a
    d
    v
    • 4
    • 8
  • d

    Denis

    02/11/2021, 2:47 PM
    [SOLVED] I want to open some Compose sources in Android Studio. But it shows a decompiled
    .class
    file, prompts to download sources, and then I get this:
    Execution failed for task ':app:DownloadSources'.
    > Could not resolve all files for configuration ':app:downloadSources_...'.
       > Could not find androidx.compose.foundation:foundation-layout:1.0.0-alpha12@aar.
    What could be the reason of it? (Earlier today I removed
    ~/.gradle/cache
    directory, in the process of upgrading to compose alpha12. )
    • 1
    • 2
  • v

    Vivek Sharma

    02/11/2021, 3:26 PM
    I was using ModalBottomSheet like this:
    ModalBottomSheetLayout(
        sheetContent = {
            // sheet content
        }
    ) {
       // content of rest of the screen
    }
    So when I trigger
    modalBottomSheetState.show()
    , sheet gets visible and blocks screen behind it but the
    back button is not closing the sheet
    So I created composable and added it to navigation, but now sheet is
    taking fullscreen, regardless of sheet content and modifier.height()
    , so how can I achieve behaviour like bottom sheet blocking back screen and navigating back
    d
    a
    s
    • 4
    • 7
  • n

    natario1

    02/11/2021, 5:47 PM
    Why can't I CMD-B into the
    remember
    function declaration? Is it like a dummy symbol that is interpreted by the compiler?
    👀 2
    a
    • 2
    • 2
  • v

    Vsevolod Ganin

    02/11/2021, 6:00 PM
    I think I got an infinite loop in
    Recomposer.kt
    . Only Compose’s code in the thread stack. I’m on alpha12
    Untitled
    a
    • 2
    • 3
  • v

    Vivek Sharma

    02/11/2021, 6:15 PM
    Class 'androidx.navigation.compose.NavHostControllerKt' is compiled by an unstable version of the Kotlin compiler and cannot be loaded by this compiler
    I updated to
    alpha12
    and getting error , any reasons?
    i
    • 2
    • 5
  • a

    Alex Barcelo

    02/11/2021, 6:25 PM
    Is it possible that latest Navigation Compose is missing a dependency with
    activity-compose
    ? When calling NavHost(…) the app crashs with
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/activity/compose/LocalOnBackPressedDispatcherOwner;
    . I added the following dependency to my project:
    implementation("androidx.activity:activity-compose:1.3.0-alpha02")
    and not it seems to work smoothly
    i
    • 2
    • 5
  • e

    eygraber

    02/11/2021, 9:00 PM
    How would I find out the measurements for a specific node? For example, if I want to load an image from a remote service that accepts a width and height parameter, and I want to set that width and height to match the layout, how can I get that information?
    k
    j
    +3
    • 6
    • 12
  • t

    tylerwilson

    02/11/2021, 9:15 PM
    Sorry, I know this is not directly related to compose, but this happened when i tried to go back to alpha11 from alpha12. I now have these Duplicate errors like so:
    Duplicate class androidx.compose.runtime.savedinstancestate.ExperimentalRestorableStateHolder found in modules jetified-runtime-saveable-1.0.0-alpha12-runtime (androidx.compose.runtime:runtime-saveable:1.0.0-alpha12) and jetified-runtime-saved-instance-state-1.0.0-alpha11-runtime (androidx.compose.runtime:runtime-saved-instance-state:1.0.0-alpha11)
    Anybody here know how to clean out the jetifier cache? I tried cleaning all Gradles caches, but that did not fix it. Thanks!
    j
    i
    s
    • 4
    • 14
  • s

    spierce7

    02/12/2021, 12:00 AM
    If I wanted to rotate an entire screen 90 degrees, and set the width to the screen height, and the height to the screen width (this is for a vertical screen on apple tv, and the landscape to portrait rotation doesn’t do what’s expected), what would be the best way to do that with compose, since I don’t have the rendered width and height when declaring size in compose?
    j
    • 2
    • 3
  • i

    itnoles

    02/12/2021, 12:06 AM
    How I can get Kotlin 1.4.30 for AS Canary 7?
    j
    v
    • 3
    • 8
  • z

    zoha131

    02/12/2021, 1:04 AM
    After reading the source code and some texts here I think people are saying that
    DisposableEffect
    with empty
    onDispose
    is a code smell. And we should avoid that. I want to load an article from server after user open the detail page. What should be the recommended way to load the data? Previously I was using
    onActive
    to load the data. ViewModel emits
    StateFlow
    which the view collect as state.
    // pre- Alpha-11
        onActive { viewModel.loadData(articleID) }
    
        // post - Alpha-11
        DisposableEffect(articleID){
            viewModel.loadData(articleID)
            onDispose {  }
        }
    z
    a
    +3
    • 6
    • 28
  • t

    Tony Kazanjian

    02/12/2021, 1:39 AM
    Anybody using
    koin.androidx.compose
    for viewmodel injection into their composables? There is a solution for compile errors for compose alpha 12 here (https://github.com/InsertKoinIO/koin/issues/1006), but wondering if others have seen the same runtime errors and if there are workarounds
    i
    • 2
    • 4
  • k

    Karthick

    02/12/2021, 5:24 AM
    I have a suggestion for ModalBottomSheetLayout, users should have explicitly pass sheet state. Because I called sheetState.show() without passing sheetState to ModalBottomSheetLayout because it has a default parameter value and getting exception
    s
    j
    • 3
    • 4
  • c

    Colton Idle

    02/12/2021, 6:03 AM
    Starting with Arctic Fox Canary 6, you can now inspect layouts written with the new Android declarative UI framework, Jetpack Compose. Whether your app uses layouts fully written in Compose or layouts that use a hybrid of Compose and Views, the Layout Inspector helps you understand how your layouts are rendered on your running device.
    This feature requires that each module using the Compose UI declare the following dependencies.
    Way cool feature!!! Good job team
    a
    • 2
    • 2
  • a

    allan.conda

    02/12/2021, 9:08 AM
    Is this no longer needed?
    Flag is not supported by this version of the compiler: -Xallow-jvm-ir-dependencies
    b
    • 2
    • 4
Powered by Linen
Title
a

allan.conda

02/12/2021, 9:08 AM
Is this no longer needed?
Flag is not supported by this version of the compiler: -Xallow-jvm-ir-dependencies
ok seems it’s removed from the setup page
hmm seems it’s added somewhere within compose now, so I can’t remove it
b

BenjO

02/12/2021, 9:18 AM
here it is https://kotlinlang.slack.com/archives/CJLTWPH7S/p1613040816185600
a

allan.conda

02/12/2021, 9:18 AM
Thank you, I swear I tried to search for it first bust nothing was showing up 🙏
😆 1
View count: 2