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

    Dominaezzz

    12/06/2020, 5:18 PM
    Is there something like
    onDispose
    for
    remember
    ?
    a
    z
    a
    • 4
    • 14
  • k

    Kshitij Patil

    12/06/2020, 8:39 PM
    I'm getting this error when I moved a composable to separate fragment This Composable is being rendered inside a
    FragmentContainerView
    hosted inside a LinearLayout but sadly I need to use that LinearLayout in the xml
    , what can be done to make this work?
    java.lang.IllegalStateException: Nesting scrollable in the same direction layouts like ScrollableContainer and LazyColumnFor is not allowed. If you want to add a header before the list of items please take a look on LazyColumn component which has a DSL api which allows to first add a header via item() function and then the list of items via items().
            at androidx.compose.foundation.ScrollKt.assertNotNestingScrollableContainers-k00exg4(Scroll.kt:464)
            at androidx.compose.foundation.lazy.LazyListState.measure-5vC3nwU$foundation_release(LazyListState.kt:248)
            at androidx.compose.foundation.lazy.LazyListKt$LazyList$1.invoke(LazyList.kt:62)
            at androidx.compose.foundation.lazy.LazyListKt$LazyList$1.invoke(LazyList.kt)
            at androidx.compose.ui.layout.SubcomposeLayoutState$createMeasureBlocks$1.measure-8A2P9vY(SubcomposeLayout.kt:211)
            at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:47)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.foundation.layout.PaddingModifier.measure-za8Wrwc(LayoutPadding.kt:210)
            at androidx.compose.ui.node.ModifiedLayoutNode.performMeasure-BRTryo0(ModifiedLayoutNode.kt:36)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayerWrapper.performMeasure-BRTryo0(LayerWrapper.kt:67)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt:91)
            at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt)
            at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:133)
            at androidx.compose.ui.platform.AndroidComposeView.observeMeasureModelReads(AndroidComposeView.kt:482)
            at androidx.compose.ui.node.OuterMeasurablePlaceable.remeasure-BRTryo0(OuterMeasurablePlaceable.kt:90)
            at androidx.compose.ui.node.OuterMeasurablePlaceable.measure-BRTryo0(OuterMeasurablePlaceable.kt:63)
            at androidx.compose.ui.node.LayoutNode.measure-BRTryo0(LayoutNode.kt:1232)
            at androidx.compose.ui.layout.RootMeasureBlocks.measure-8A2P9vY(RootMeasureBlocks.kt:36)
            at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:47)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
            at androi
    I learned that I was using 
    LazyColumn
     inside a 
    Column
     and rectified my mistake but this error seems to continue showing regardless of any change.
    c
    • 2
    • 6
  • d

    dimsuz

    12/06/2020, 10:26 PM
    Hi! When doing unidirectional flows in pre-compose Android I constantly notice that it is nice to separate "static" properties from "dynamic" ones. For example if we render a
    List<User>
    where
    User(id, name, isSelected)
    and if this list is 100-200 users, then to immutably switch selection of 1 user costs a full realloc of whole List + 1 user object. In light of this I tend to split into something resembling
    Pair<List<User(id, name)>, Set<String>>
    , i.e. "static" user props and "dynamic" set of selected ids. It doesn't seem to be Compose specific, but I wonder, is this a good thing to do in general, or will ART optimize this anyway? And also: is there some terminology invented for this rather than mine static/dynamic thing?
    t
    a
    • 3
    • 5
  • z

    zsperske

    12/06/2020, 10:43 PM
    Is there a hook for when a composable reappears on the screen? Looking for something like
    onResume
    vs
    onStart
    in fragment land. Or am I thinking about this completely wrong?
    a
    i
    • 3
    • 19
  • t

    Tlaster

    12/07/2020, 7:59 AM
    I got the error when using
    pushStringAnnotation('Tag', 'sometext'); ...; pop();
    in
    annotatedString
    when my phone is using with some accessibility function like Screen Reader's Select to Speak.
    Fatal Exception: java.lang.ClassCastException: java.lang.String cannot be cast to androidx.compose.ui.text.TtsAnnotation
           at androidx.compose.ui.text.platform.AndroidAccessibilitySpannableStringKt.toAccessibilitySpannableString(AndroidAccessibilitySpannableString.kt:60)
           at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.populateAccessibilityNodeInfoProperties(AndroidComposeViewAccessibilityDelegateCompat.kt:235)
           at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.createNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.kt:184)
           at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.access$createNodeInfo()
           at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.createAccessibilityNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.kt:1600)
           at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfVirtualNode(AccessibilityInteractionController.java:1385)
           at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:1298)
           at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:1096)
           at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:342)
           at android.view.AccessibilityInteractionController.access$400(AccessibilityInteractionController.java:75)
           at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1460)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:223)
           at android.app.ActivityThread.main(ActivityThread.java:7656)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    🐛 1
    ☝️ 1
    m
    • 2
    • 3
  • p

    Philip Blandford

    12/07/2020, 11:04 AM
    I see that alpha08 has introduced a snapToItem() method in LazyListState - is there an example of its usage? It's a suspend function, and I'm not clear what sort of coroutine scope I should be using and where..
    a
    • 2
    • 3
  • d

    Davide Bertola

    12/07/2020, 11:13 AM
    is it possible to use jetpack compose with the stable Android Studio ?
    🇳🇴 13
    😭 1
    • 1
    • 1
  • s

    salomonbrys

    12/07/2020, 1:55 PM
    java.lang.IllegalStateException: Backend Internal error: Exception during code generation
    File being compiled: /Users/salomonbrys/Code/Acinq/phoenix-kmm/phoenix-android/src/main/java/fr/acinq/phoenix/android/utils/logger.kt
    The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:53)
    	at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
    	at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:156)
    	at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm$default(JvmBackendFacade.kt:125)
    	at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFiles(JvmBackendFacade.kt:112)
    	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:40)
    	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
    	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:647)
    	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:210)
    	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:162)
    	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
    	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
    	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
    	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
    	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
    	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:371)
    	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:249)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:38)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
    	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:602)
    	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:93)
    	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1644)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
    	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    	at java.base/java.security.AccessController.doPrivileged(Native Method)
    	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
    	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
    	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    	at java.base/java.security.AccessController.doPrivileged(Native Method)
    	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.RuntimeException: Exception while generating code for:
    FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
      annotations:
        Composable
      BLOCK_BODY
        VAR name:context type:android.content.Context [val]
          CALL 'public final fun <get-current> (): T of androidx.compose.runtime.Ambient [inline] declared in androidx.compose.runtime.Ambient' type=android.content.Context origin=null
            $this: TYPE_OP type=androidx.compose.runtime.Ambient<T of androidx.compose.runtime.Ambient> origin=IMPLICIT_CAST typeOperand=androidx.compose.runtime.Ambient<T of androidx.compose.runtime.Ambient>
              CALL 'public final fun <get-AmbientContext> (): androidx.compose.runtime.ProvidableAmbient<android.content.Context> declared in androidx.compose.ui.platform.AndroidAmbientsKt' type=androidx.compose.runtime.ProvidableAmbient<android.content.Context> origin=GET_PROPERTY
    
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:53)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:296)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:313)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:135)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate$default(ClassCodegen.kt:117)
    	at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:153)
    	... 38 more
    Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call '<get-current>' into
    @androidx.compose.runtime.Composable public fun foo(): kotlin.Unit defined in fr.acinq.phoenix.android.utils in file logger.kt
    @Composable
    fun foo() {
        val context = AmbientContext.current
    }
    Cause: Not generated
    File is unknown
    The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.getCompiledMethodNodeInner(InlineCodegen.kt:581)
    	at org.jetbrains.kotlin.codegen.inline.InlineCodegen.throwCompilationException(InlineCodegen.kt:104)
    	at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:149)
    	at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCodegen.genCall(IrInlineCodegen.kt:158)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:432)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:102)
    	at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:74)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitVariable(ExpressionCodegen.kt:544)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitVariable(ExpressionCodegen.kt:102)
    	at org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl.accept(IrVariableImpl.kt:74)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitStatementContainer(ExpressionCodegen.kt:379)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:383)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:102)
    	at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBody.kt:54)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.generate(ExpressionCodegen.kt:215)
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.doGenerate(FunctionCodegen.kt:125)
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:51)
    	... 43 more
    Caused by: java.lang.IllegalStateException: Couldn't obtain compiled function body for org.jetbrains.kotlin.ir.descriptors.IrBasedPropertyGetterDescriptorWithContainerSource@5096f940
    	at org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.getCompiledMethodNodeInner(InlineCodegen.kt:581)
    	at org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.createInlineMethodNode$backend(InlineCodegen.kt:545)
    	at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:140)
    	... 57 more
    a
    • 2
    • 1
  • s

    salomonbrys

    12/07/2020, 1:55 PM
    Hey guys. I'm having a compiler error since updated my app to: • Android Studio Arctic Fox 2020.3.1 Canary 2 • Android Gradle Plugin 7.0.0-alpha02 • Kotlin to 1.4.20 • Compose version to 1.0.0-alpha08. The simplest compose method does not compile, i.e.:
    @Composable
    fun foo() {
        val context = AmbientContext.current
    }
    gives the following error:
    m
    • 2
    • 2
  • b

    BenjO

    12/07/2020, 3:55 PM
    :android-wave: I'm having reeeeeally slow composable preview rendering time in Android Studio. Between 30s if I'm lucky, up to 1min. I'm using • Windows 10 (cpu 8 cores, 24GB RAM) • Android Studio Arctic Fox 2020.3.1 Canary 2 • Android Gradle Plugin 7.0.0-alpha02 • Kotlin to 1.4.20 • Compose version to 1.0.0-alpha08. I disabled my antivirus and added rules to exclude project files, but still no luck... I'm previewing one composable at a time. I tested few weeks ago on a MacBook, it was much much faster. Performance might not be a major concern right now, but if someone has a clue on how to improve it a bit, I take it !
    b
    c
    • 3
    • 6
  • z

    zsperske

    12/07/2020, 5:48 PM
    Are there any known issues with
    vectorResource
    ? This asset draws as white when placed in the
    TopAppBar.navigationIcon
    of a
    Scaffold
    <vector xmlns:android="<http://schemas.android.com/apk/res/android>"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
      <path
          android:pathData="M12.1523,2C9.2617,1.957 6.6484,3.1563 4.7969,5.0898L2.8555,3.1445C2.6602,2.9531 2.3398,2.9531 2.1484,3.1445C2.0469,3.2422 2,3.3711 2,3.5L2,8C2,8.5508 2.4492,9 3,9L7.5,9C7.6289,9 7.7539,8.9492 7.8555,8.8555C8.0469,8.6602 8.0469,8.3398 7.8555,8.1484L6.2188,6.5078C8.0273,4.6016 10.75,3.5703 13.6914,4.1758C16.7656,4.8125 19.2305,7.3008 19.8398,10.3789C20.8516,15.5 16.9414,20 12,20C7.8828,20 4.4805,16.8711 4.0469,12.8633C3.9922,12.3672 3.5625,12 3.0625,12C2.4609,12 1.9961,12.5234 2.0625,13.1211C2.6211,18.1094 6.8672,22 12,22C18.1367,22 23,16.4453 21.8242,10.0977C21.0781,6.0742 17.8164,2.8594 13.7891,2.1563C13.2344,2.0586 12.6875,2.0117 12.1523,2.0039ZM12,6C11.4492,6 11,6.4492 11,7L11,12C11,12.2656 11.1055,12.5195 11.293,12.707L13.5859,15C13.9766,15.3906 14.6094,15.3906 15,15C15.3906,14.6094 15.3906,13.9766 15,13.5859L13,11.5859L13,7C13,6.4492 12.5508,6 12,6ZM12,6"
          android:fillColor="#3498DB"
          android:fillType="nonZero"
          android:strokeColor="#00000000"/>
    </vector>
    b
    • 2
    • 2
  • f

    frankelot

    12/07/2020, 6:13 PM
    Quick question, I want to have a layout where children views can place themselves wherever they want (x y relative to the parent layout)… not sure how to acomplish this in #Compose 🤔 Tried creating a custom layout and using:
    placeable.placeRelative(x = 0, y = 0)
    but I don’t have a way of asking the view where it wants to be placed
    r
    b
    • 3
    • 4
  • d

    Daniele B

    12/07/2020, 6:22 PM
    New slide for my presentation, trying to describe the “coupling” between ViewModel and UI, in both Imperative and Declarative UIs
    b
    k
    +3
    • 6
    • 40
  • n

    Nat Strangerweather

    12/07/2020, 7:23 PM
    is it possible to have modifiers under certain conditions only? For instance, here: is it possible to have modifiers under certain conditions only? For instance, here:
    Card(
    Modifier
    .clickable(indication = null, onClick = {}
    I want my card to be clickable only if the "isEnabled" Boolean is true. Something like
    .if (isEnabled) clickable()
    ...
    z
    a
    l
    • 4
    • 9
  • v

    Val Salamakha

    12/07/2020, 9:19 PM
    Does “kotlin 1.4.21-release-Studio4.2-1” support compose?
    j
    • 2
    • 2
  • z

    zsperske

    12/07/2020, 9:23 PM
    Does anyone know where I can find the samples referenced in the documentation? things like
    androidx.ui.material.samples.FancyIndicator
    t
    • 2
    • 2
  • s

    Sam

    12/07/2020, 9:38 PM
    Hi, I have a brand new compose
    alpha08
    app from the latest android studio arctic fox canary 2 project template, the only code is this:
    Column(Modifier.fillMaxSize()) {
        Text("title")
        ScrollableColumn {
            Text("message")
        }
        val text = remember { mutableStateOf(TextFieldValue()) }
        OutlinedTextField(
            value = text.value,
            onValueChange = { text.value = it },
            placeholder = { Text(text = "Watch me animate...") },
            modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp)
        )
    }
    My question is, why is it that when I focus the software keyboard on a Pixel 4a device, does everything get shifted up so that the keyboard stays in view? How can I disable this behavior so that I have more fine grained control, for example using
    accompanist
    lib for insets?
    • 1
    • 1
  • z

    zsperske

    12/07/2020, 10:06 PM
    Can you use compose navigation in a project that is already using the navigation component? Trying to follow the navigation guide and not seeing the method I need.
    implementation("androidx.navigation:navigation-fragment-ktx:2.3.2")
    implementation("androidx.navigation:navigation-ui-ktx:2.3.2")
    implementation("androidx.navigation:navigation-compose:1.0.0-alpha03")
    i
    • 2
    • 2
  • z

    zsperske

    12/08/2020, 1:59 AM
    Is it normal to have nested
    NavHost
    s? Or should the entire graph be defined at the top level?
    a
    i
    +2
    • 5
    • 29
  • t

    tylerwilson

    12/08/2020, 11:36 AM
    Simple question, I think: how can I set the offset of an item as a percentage of the total width. There is a fillMaxWidth that takes a fraction, so something like offsetMaxWidth(0.5) ?
    s
    • 2
    • 2
  • j

    jaqxues

    12/08/2020, 12:15 PM
    I want to draw a tree graph, how should I procede? I doubt putting everything into a single Canvas would work well, so I suppose a custom Layout, where I can put the Node Composables? But what would be the best way to keep track of what is connected to what?
    c
    z
    • 3
    • 6
  • z

    zoha131

    12/08/2020, 3:21 PM
    How to observe scroll position of a
    ScrollableColumn
    ?
    n
    z
    • 3
    • 3
  • h

    Heba

    12/08/2020, 3:29 PM
    Hello everyone 🙂, Im wondering if compose is safe to be used in production apps (by spring 2021) , My concerns are not about api changes but about stability, any help will be appreciated
    🇳🇴 4
    z
    j
    +2
    • 5
    • 8
  • c

    codeslubber

    12/08/2020, 5:31 PM
    Being able to run Previews in the emulator is really cool. But we noticed that once we converted a module to a Library, that became impossible? is there a solution to that? (other than copy/paste it into the app source space)?
    v
    b
    • 3
    • 8
  • z

    zsperske

    12/08/2020, 6:08 PM
    Does anyone else wish cmd+o would find your composable functions? i've started adding empty classes with the same name as my composables at the top of the file
    d
    r
    +6
    • 9
    • 19
  • s

    Sam

    12/08/2020, 6:34 PM
    What’s going on with the compose app deploy-to-device bug? I’m counting 9 separate reports here about the same problem, it’s really killing productivity and there isn’t anyone providing an ETA on the fix: https://issuetracker.google.com/issues?q=componentid:192745%20status:open
    • 1
    • 1
  • z

    ziv kesten

    12/08/2020, 6:55 PM
    What is the proper way to expose paging from a viewModel to a composable?. Ideally I would expose a paging source from the view model and create the pager in the composable, with remember. However this doesn't seem to work (using stateFlow) Since the pager is not calling the load function of the mediator.
    c
    a
    c
    • 4
    • 8
  • z

    zsperske

    12/08/2020, 9:25 PM
    Has anyone worked out a nice pattern for localizing strings?
    v
    c
    • 3
    • 3
  • s

    sindrenm

    12/08/2020, 10:17 PM
    Any downsides to
    operator fun <T> State<T>.component1(): T = value
    ? Being able to destructure a
    State
    is very useful when the value of the
    State
    is nullable. Such as:
    val (content) = viewModel.content.collectAsState()
    
    if (content != null) {
        SomeContent(content)
    } else {
        MissingContent()
    }
    (Using a
    StateFlow
    here, but applies for any other way of retrieving a
    State
    as well.) I don't find the property delegate very useful in this situation, as smart-casting can't be done in that case (custom getter and all that). Is this something that would make sense to even add to the standard lib?
    z
    a
    s
    • 4
    • 9
  • n

    Noé Casas

    12/08/2020, 11:37 PM
    Is it possible to set a
    TextField
    ’s text vertical alignment to “top”? How? By default the text is in the middle. Setting
    Modifier.align(<http://Alignment.Top|Alignment.Top>)
    does not help.
    z
    a
    • 3
    • 3
Powered by Linen
Title
n

Noé Casas

12/08/2020, 11:37 PM
Is it possible to set a
TextField
’s text vertical alignment to “top”? How? By default the text is in the middle. Setting
Modifier.align(<http://Alignment.Top|Alignment.Top>)
does not help.
z

zsperske

12/09/2020, 4:14 AM
i think there's a baseline alignment for text fields
a

Anastasia [G]

12/10/2020, 10:57 AM
I’m afraid you can’t do this at the moment using TextField. There is a new spec being implemented where the text will be aligned to the top for multiline text field. At the moment you can only achieve this using BasicTextField
n

Noé Casas

12/10/2020, 11:16 AM
Thanks @Anastasia [G], I will use upgrade to the latest alpha to use
BasicTextField
.
View count: 4