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

    03/10/2021, 5:03 PM
    Feeling really dumb. Can't get text to center inside of a row. Code inside the thread.
    l
    k
    • 3
    • 11
  • l

    louiscad

    03/10/2021, 6:12 PM
    Hello, I'm on Canary 9 and I'm not getting the
    Code | Split | Design
    selector when using the
    @Preview
    annotation. What might be the cause? On what is this showing up based upon? Here's how it looks like on my machine. EDIT: Yes, I tried restarting the IDE.
    c
    • 2
    • 3
  • i

    itnoles

    03/10/2021, 6:41 PM
    Speed Round?
    ❓ 1
    c
    • 2
    • 2
  • t

    tcracknell

    03/10/2021, 6:51 PM
    Hello! The latest Jetpack Compose minor release, beta02, is here. You can get it now from Google’s Maven Repository. Release notes are available at https://developer.android.com/jetpack/androidx/versions/all-channel. There are still opportunities to join the #AndroidDevChallenge at http://d.android.com/dev-challenge!
    🥶 1
    🚀 10
    :party-parrot: 23
    z
    t
    +3
    • 6
    • 5
  • c

    Colton Idle

    03/10/2021, 7:20 PM
    Somewhat related... has anyone been able to use download the kotlin 1.4.31 plugin in Android Studio canary 9?
    🇳🇴 2
    a
    g
    • 3
    • 6
  • f

    FunkyMuse

    03/10/2021, 8:50 PM
    Why's that every time a navigation composable that's on the bottom navigation creates a new view model when the user clicks on the bottom navigation item i'm using
    implementation "androidx.hilt:hilt-navigation-compose:1.0.0-alpha01"
    and
    val viewModel: LatestBooksViewModel = hiltNavGraphViewModel(navBackStackEntry)
    i don't want to create a new view model each time the user clicks the bottom navigation since it's just wasting API calls
    i
    • 2
    • 3
  • j

    jaqxues

    03/10/2021, 9:06 PM
    Is there a purely Compose way to play Video? I see a lot of people use AndroidView to use the ExoPlayer or some other android Surface class stuff. Is there no 'compose' way?
    a
    z
    +2
    • 5
    • 6
  • e

    eygraber

    03/10/2021, 9:24 PM
    How do derivatives of compose code work in terms of licensing? For example, if I took code from one of the Compose samples in AOSP and improved it / added features, and want to make an open sourced library out of it, do I need to do anything special? Is this the wrong channel for that topic?
    a
    • 2
    • 1
  • n

    Noé Casas

    03/10/2021, 11:21 PM
    Will
    TextField
    support `AnnotatedString`s like
    Text
    ? Doing so would make it possible to implement wysiwyg rich text editors.
    s
    • 2
    • 2
  • t

    Tim Malseed

    03/11/2021, 12:12 AM
    Using Compose in Android Studio, I pretty much have to clean & build every time, or the app crashes on launch:
    java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/jvm/functions/Function3;)V in class Lcom/acompany/weightr/features/Screen; or its super classes
    ..
    If I make any code edits and try to deploy the app, I get this crash almost every time. Cleaning, building and running again always fixes the issue. Has anyone else encountered this, and is it tracked anywhere?
    l
    • 2
    • 4
  • k

    Konyaco

    03/11/2021, 12:41 AM
    Cannot resolve package
    androidx.compose.ui.util
    . Unresolved reference:
    fastMap
    ,
    lerp
    ,
    fastForEach
    etc. Compose 1.0.0-beta2, Android Studio Canary 9. Anybody got the same problem?
    a
    • 2
    • 2
  • b

    bohregard

    03/11/2021, 2:44 AM
    I’m having an issue with beta02 and AndroidView and scrolling (see video below). When I scroll the view scrolls faster than everything else
    ➕ 3
    h
    a
    +4
    • 7
    • 22
  • s

    Shivam Sethi

    03/11/2021, 3:20 AM
    I want to update
    compose
    to
    beta02
    , but when I increment the version I get this error? I am not seeing any
    Kotlin
    version update, I checked the latest updates. I am using latest AS Canary ?
    r
    i
    t
    • 4
    • 14
  • t

    Tlaster

    03/11/2021, 4:11 AM
    Getting
    java.lang.ClassCastException: androidx.compose.ui.platform.ParcelableMutableStateHolder cannot be cast to androidx.compose.runtime.MutableState
    after 1.0.0-beta02 when using
    rememberSaveable
    without custom saver, full stacktrace in thread
    👍 1
    j
    a
    • 3
    • 12
  • s

    Saiedmomen

    03/11/2021, 6:56 AM
    In the Kdoc documentation there are numerous
    @sample
    references
    * @sample androidx.compose.material.samples.CardSample
    But they are not working for me and I can't see the samples. Is there a dependency that I'm missing? There was nothing in the google maven
    j
    a
    c
    • 4
    • 8
  • e

    eygraber

    03/11/2021, 8:02 AM
    I published the first build of a multiplatform compose color picker based on the sample from AOSP. I'm sure there's a lot that can be improved, so feedback would be greatly appreciated 😄 https://github.com/eygraber/compose-color-picker
    🎉 5
    p
    • 2
    • 2
  • l

    louiscad

    03/11/2021, 8:44 AM
    Hello folks! For the ones here that tried to use Compose in an Android Library Module, were you successful, or did you encounter issues? If not, I'm also interested in the exact issues you had.
    :yes-black: 2
    :nope: 1
    b
    t
    b
    • 4
    • 4
  • d

    Deepak Gahlot

    03/11/2021, 9:01 AM
    facing an issue with updating to beta02
    Could not GET '<https://dl.google.com/dl/android/maven2/androidx/compose/compiler/compiler/1.0.0-beta02/compiler-1.0.0-beta02.pom>'. Received status code 503 from server: Service Unavailable
    Disable Gradle 'offline mode' and sync project
    ✅ 1
    l
    • 2
    • 3
  • t

    Tlaster

    03/11/2021, 10:20 AM
    Does anyone getting
    java.lang.IllegalArgumentException: Failed requirement
    at
    MeasureAndLayoutDelegate.kt:194
    after beta02? full stacktrace in thread
    f
    • 2
    • 6
  • l

    loloof64

    03/11/2021, 10:48 AM
    Hi : I am trying to build a dynamic chess board (with drag and drop), but in my early stage, it is not reactive.
    • 1
    • 3
  • a

    Archie

    03/11/2021, 11:17 AM
    Hi, I am trying to add Compose Dependencies inside a
    Kotlin Multiplatform Module
    where all compose related code would be inside
    androidMain
    but although there are no code error, and the app gets successfully built, the application crashes when referencing a
    Composable
    defined inside the
    KMM
    Module. Here is the Error:
    java.lang.NoSuchMethodError: No static method Sample(Landroidx/compose/runtime/Composer;I)V in class Lph/kmm/feature/compose/SampleKt; or its super classes (declaration of 'com.kmm.compose.SampleKt' appears in /data/app/com.kmm.compose-TrHVyznV0bVt58iksPYp3g==/base.apk!classes7.dex)
    • 1
    • 2
  • a

    alorma

    03/11/2021, 11:29 AM
    using
    beta02
    I'm getting:
    ViewTreeLifecycleOwner not set for this ComposeView. If you are adding this ComposeView to an AppCompatActivity, make sure you are using AppCompat version 1.3+.
    • 1
    • 1
  • o

    Orhan Tozan

    03/11/2021, 11:30 AM
    Anyone else getting
    java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from DecorView@8896299[MainActivity]
    after upgrading to beta02?
    a
    p
    • 3
    • 7
  • t

    Timo Drick

    03/11/2021, 12:27 PM
    I am working on an Google TV/Android TV app. The focus system is only working when i add the focusOrder modifier to the items like in this code: https://cs.android.com/androidx/platform/frameworks/support/+/0a6f6ab5001b4885cf6f47[…]/java/androidx/compose/ui/demos/focus/CustomFocusOrderDemo.kt. Which is not really practical when working with Lazy lists.
    a
    w
    • 3
    • 11
  • c

    CLOVIS

    03/11/2021, 2:18 PM
    Hi! The Jetpack Compose documentation insists quite a lot that
    @Composable
    functions should not block nor suspend, and says that an event (a button click, for example) should be transmitted ‘up' and dealt with there. I don't really understand what this means or how it works in practice, and I can't find a page that describes that... Assuming I have a simple function (that simulates a network call):
    suspend fun networkGet(id: Int): String {
      delay(2000)
      return "some interesting value"
    }
    I would want to have a UI that has a button to launch the request, which then displays the results (whenever they arrive). I guess the
    Composable
    function should look like this:
    @Composable
    fun SomeView(results: List<String>, onRequest: (Int) -> Unit) {
      Column {
        Button(onClick = { onRequest(5) } {
          Text("Load next")
        }
        for (result in results) {
          Text(result)
        }
      }
    }
    So far it makes sense to me, but I don't understand how the call site would handle the event.
    d
    t
    • 3
    • 9
  • j

    jim

    03/11/2021, 3:13 PM
    I just ran across this doc which gives official androidx guidance around mocking: https://android.googlesource.com/platform/frameworks/support/+/androidx-main/docs/do_not_mock.md It nominally applies to the androidx codebase, but I'd encourage external developers to adopt similar thinking, as it really cleans up both your APIs and ensures you're testing the right contracts.
    😍 4
    💯 3
    b
    j
    • 3
    • 5
  • s

    steelahhh

    03/11/2021, 3:17 PM
    Does anyone else notice that Compose takes some time to "warm up" when used in Android Views? In our project we're relying on Android interop to integrate Compose into existing fragments, and first screen open produces a lot of skipped frames/lag, but consequent launches are a lot more smooth I'll try to isolate it and create a repro, but just wondering if it's an us problem, or a Compose internals problem
    d
    a
    +3
    • 6
    • 24
  • e

    eygraber

    03/11/2021, 4:17 PM
    I find myself sorely missing ConstraintLayout in Compose, but I have some concerns about using the Compose version of it. Anyone else feel the same way? More details in the thread.
    t
    • 2
    • 3
  • l

    loloof64

    03/11/2021, 4:18 PM
    I've been trying to debug my code all this afternoon, but without success. Meanwhile, I've updated compose to the
    1.0.0-beta02
    Does not run on my device any more
    s
    l
    t
    • 4
    • 40
  • s

    Se7eN

    03/11/2021, 4:33 PM
    How do I send a url as a nav argument? I'm getting an error when passing it as a string because it's confusing the url arguments with nav arguments
    i
    • 2
    • 3
Powered by Linen
Title
s

Se7eN

03/11/2021, 4:33 PM
How do I send a url as a nav argument? I'm getting an error when passing it as a string because it's confusing the url arguments with nav arguments
i

Ian Lake

03/11/2021, 5:38 PM
Uri.encode()
would the be usual way to encode content
Can I ask what your use case is?
s

Se7eN

03/12/2021, 12:25 PM
Thanks, I'll try it. I'm sending an image URL to a photo editor screen.
View count: 6