s

    ste

    1 year ago
    Solved: had to update both android studio and gradle (🤦‍♂️). I'm having troubles upgrading compose to beta07:
    java.lang.IllegalStateException: function = <anonymous>, count = 4, index = 4
    .
    beta06
    was working fine. I also upgraded navigation to
    2.4.0-alpha01
    , but didn't help. Full error in thread.
    java.lang.IllegalStateException: function = <anonymous>, count = 4, index = 4
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.wrapFunctionExpression(ComposerLambdaMemoization.kt:671)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitComposableFunctionExpression(ComposerLambdaMemoization.kt:529)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitFunctionExpression(ComposerLambdaMemoization.kt:591)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:235)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:24)
    	at org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl.accept(IrFunctionExpressionImpl.kt:23)
    	at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:33)
    	at org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression.transformChildren(IrFunctionAccessExpression.kt:48)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:131)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitMemberAccess(IrElementTransformerVoid.kt:192)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionAccess(IrElementTransformerVoid.kt:195)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:198)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitCall(ComposerLambdaMemoization.kt:505)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:199)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
    	at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:47)
    	at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:33)
    	at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:26)
    	at org.jetbrains.kotlin.ir.expressions.IrBlockBody.transformChildren(IrBody.kt:62)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:108)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:117)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:118)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:24)
    	at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBody.kt:54)
    	at org.jetbrains.kotlin.ir.expressions.IrBody.transform(IrBody.kt:27)
    	at org.jetbrains.kotlin.ir.declarations.IrFunction.transformChildren(IrFunction.kt:71)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitDeclaration(ComposerLambdaMemoization.kt:323)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunction(IrElementTransformerVoid.kt:69)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitFunction(ComposerLambdaMemoization.kt:367)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:72)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:73)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:24)
    	at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:28)
    	at org.jetbrains.kotlin.ir.IrElement$DefaultImpls.transform(IrElement.kt:32)
    	at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:19)
    	at org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl.transformChildren(IrFileImpl.kt:71)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitPackageFragment(IrElementTransformerVoid.kt:41)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:47)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitFile(ComposerLambdaMemoization.kt:305)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:48)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:24)
    	at org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl.accept(IrFileImpl.kt:63)
    	at org.jetbrains.kotlin.ir.declarations.IrFile.transform(IrFile.kt:48)
    	at org.jetbrains.kotlin.ir.declarations.impl.IrModuleFragmentImpl.transformChildren(IrModuleFragmentImpl.kt:45)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:330)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.lower(ComposerLambdaMemoization.kt:319)
    	at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:73)
    	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$generateModule$1.invoke(JvmIrCodegenFactory.kt:93)
    	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory$generateModule$1.invoke(JvmIrCodegenFactory.kt:89)
    	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:91)
    	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:106)
    	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
    	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:595)
    	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:211)
    	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:154)
    	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:386)
    	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:110)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:286)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:99)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:114)
    	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:74)
    	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
    	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
    	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1659)
    	at jdk.internal.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
    	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)
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    Are you able to narrow down what code is causing the compiler error?
    s

    ste

    1 year ago
    @Zach Klippenstein (he/him) [MOD] I tried commenting out many lines of code, but it just gives another error. I'll try again btw
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    Narrowing down compiler errors can be pretty tricky sometimes – if your code is open source, you could just file a bug and link your project on the ticket.
    s

    ste

    1 year ago
    @nglauber Yup I already upgraded every dependency 😕
    This is the minimal code...
    import androidx.compose.runtime.Composable
    
    @Composable
    fun Foo(content: @Composable () -> Unit) {
    }
    
    @Composable
    fun Bar() {
        Foo {
        }
    }
    may be my
    build.gradle.kts
    messed up?
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    Oof, yea that definitely seems like a local thing to me - or nobody would be able to use beta07 at all 😓
    Have you tried wiping all your build caches? Are you using configuration caching?
    YASAN

    YASAN

    1 year ago
    I cant use beta07 as well
    2021-05-24 00:22:28.528 7151-7151/yasan.space.mnml.ai.launcher.dev E/AndroidRuntime: FATAL EXCEPTION: main
        Process: yasan.space.mnml.ai.launcher.dev, PID: 7151
        java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)V in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer' appears in /data/app/yasan.space.mnml.ai.launcher.dev-tZeZjYAWS0SQQSawBh5N2w==/base.apk)
            at com.google.accompanist.systemuicontroller.SystemUiControllerKt.rememberAndroidSystemUiController(Unknown Source:5)
            at yasan.space.mnml.ai.launcher.ui.YasanLauncherKt.YasanLauncher(YasanLauncher.kt:22)
            at yasan.space.mnml.ai.launcher.MainActivity$onCreate$2.invoke(MainActivity.kt:86)
            at yasan.space.mnml.ai.launcher.MainActivity$onCreate$2.invoke(MainActivity.kt:84)
    YasanLauncher.kt:22
    points to this code
    val controller = rememberAndroidSystemUiController()
    which IS deprecated but I was too lazy to update it lol, although I am not sure if updating it would fix the issue or not
    Same result even after replacing it with
    rememberSystemUiController()
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    @YASAN your case looks like you’re just using a library that was compiled with a compose version earlier than beta07 (that
    startReplaceableGroup
    function is the key - it was only introduced in beta07).
    Arkadii Ivanov

    Arkadii Ivanov

    1 year ago
    The latter issue is documented in the release notes:
    YASAN

    YASAN

    1 year ago
    Does that mean I just have to invalidate cache and try again?
    Arkadii Ivanov

    Arkadii Ivanov

    1 year ago
    @YASAN to resolve the NoSuchMethodError you need to ensure that there are no transitive dependencies using earlier versions of Compose.
    YASAN

    YASAN

    1 year ago
    Oh right I miss-read the image sorry
    s

    ste

    1 year ago
    I got it working. Had to update both android studio and gradle 🤦‍♂️
    YASAN

    YASAN

    1 year ago
    Looks like mine was due to accompanist libraries (the version was not highlighted in the UI but they had updates available) but I cant build yet since I am trying to figure out what to pass to
    CompositionLocalProvider
    I just fully removed
    CompositionLocalProvider()
    and it worked... lol. although it'll probably have side effects since
    rememberSystemUiController()
    is no longer being used at all. It build and works fine other than that. 🙌