https://kotlinlang.org logo
#compose
Title
# compose
m

Mini

12/03/2020, 1:12 PM
Trying to add 1.0.8 to an existing project, kotlin 1.4.20
Copy code
composeOptions {
    kotlinCompilerVersion '1.4.20'
    kotlinCompilerExtensionVersion '1.0.0-alpha08'
}
kotlinOptions {
    useIR = true
    jvmTarget = "1.8"
}
Everything works until I add buildFeatures { compose true } When compose is enabled the project never finishes building. I have multiple attempts, and my last one has been running for 3 hours 36 minutes 😕 Any ideas what might be wrong?
j

jim

12/03/2020, 1:16 PM
That sounds like maybe we have an infinite loop or something in the Compose Compiler. You could try doing a
kill -3
to see what is on the stack. Or better yet, can you try to create a minimal repro and post it to github so we can investigate?
m

Mini

12/03/2020, 1:20 PM
Could you explain what you mean by doing a
kill -3
? 😅
j

Javier

12/03/2020, 1:22 PM
Maybe you are using something that uses kapt or kotlin Serialization?
m

Mini

12/03/2020, 1:23 PM
yeah there are still synthetics in the project. I thought with 1.4.20 and 1.0.8 you could use both blob thinking upside down
j

jim

12/03/2020, 1:41 PM
kill -3
is an easy way to send a SIGQUIT to a running java process, which will result in the process dumping the jvm state including all thread stacks (https://www.baeldung.com/java-thread-dump#1-kill--3-command-linuxunix). But it's not the only way to get stack traces (as per other options in that same link). It would provide a hint as to what's going on, but it's not guaranteed to give us a useful answer, so if you aren't familiar with capturing JVM stacks, probably a minimal repro would be the best way to ensure we're able to reproduce and fix the issue.
🙌 1
m

myanmarking

12/03/2020, 5:03 PM
i also struggled with that problem. Did you find the solution?
Btw, any change you also using viewBinding in the same project? If so, i got the solution for you 😛
actually, for me was serialization i think, not viewbinding
for me it was a conflict between kotlin-parcelize and compose in the same module. moved kotlin-parcelize to a separate module which fixed the problem
m

Mantas Varnagiris

12/07/2020, 10:00 AM
I have exactly the same issue. I tried adding compose to existing project and it ends up being stuck at
> Task :app:compileDevDebugKotlin
My project is quite complex so for me it's hard to distil what the problem is. I'm currently in the process of migrating kotlin-synthetics to viewbinding so it might be related
m

Mini

12/07/2020, 10:01 AM
I finally caved, spent most of saturday replacing all of the synthetics with viewbinding 😅 Now it works 🙂
m

Mantas Varnagiris

12/07/2020, 10:02 AM
Oh so was that the issue? Maybe I should bite the bullet and do it as well 🙂
m

Mini

12/07/2020, 10:02 AM
I think so, yeah!
j

Javier

12/07/2020, 10:05 AM
@Mantas Varnagiris kapt in the same module will give you problems too (if you are using room for example)
or kotlin serializarion
m

Mantas Varnagiris

12/07/2020, 10:06 AM
I have kapt, but it's for Hilt. So that also might be an issue
j

Javier

12/07/2020, 10:13 AM
you can check the samples where they use hilt to see a way to create the module structure to get it working
👍 1
2 Views