Migrating from Dev05 (works perfect) to Dev07 on A...
# compose
a
Migrating from Dev05 (works perfect) to Dev07 on Android Studio 4.1 Canary 4. The project uses all the Jetpack components (ROOM etc.) including Jetpack Navigation. The composable is in a fragment so it works with Navigation.
Copy code
class ComposeFragment : Fragment() {
This worked in Dev05
Copy code
(fragmentView as ViewGroup).setContent {
    Greeting("hji", breatheData)
    //materialContent()
}
Copy code
@Composable
fun Greeting(name: String, BDdatat: MyData) {...}
I have spent the entire day making sure my build.gradle(s) are correct but I still get
java.lang.NoSuchMethodError: No static method setContent(Landroid/view/ViewGroup;Lkotlin/jvm/functions/Function0;)Landroidx/compose/Composition; in class Landroidx/ui/core/WrapperKt; or its super classes (declaration of 'androidx.ui.core.WrapperKt
I did follow https://stackoverflow.com/questions/60615308/jetpack-compose-dev06-setcontent-doesnt-work but I am at my wit's end. Any suggestions?
t
Have you changed the compiler version? I also had the same problem migrating from 06 to 07. Applying a plugin version to build.gradle solved my problem
a
I have this ...
Copy code
composeOptions {
    kotlinCompilerVersion "1.3.61-dev-withExperimentalGoogleExtensions-20200129"
    kotlinCompilerExtensionVersion "0.1.0-dev07"
}
v
Copy code
fragmentView.activity?.setContent{...}
Why not as above?
a
I had a similar problem, it seems like there were some changes in dev05 -> dev06 which changed behavior. It might be necessary to set
compose true
as well in the module which calls setContent. If that is a limitation due to kapt, I think making a setContent extension function without composables as arguments (eg no args) in a different module with
compose true
might also work
t
Here is my configs. And I don't use Fragment. I didn't need to set
kotlinCompilerVersion
👍 1
a
Thanks to everyone for the help!!! Yes I have all that. I spent an entire day checking the build.gradles(s) ... this is very confusing.
I would love to see a Git Repo that uses ROOM with Jetpack Compose ... I believe they can't work together in the same module with Dev07 but works perfect under Dev05
when I add ROOM to my Gradle build I get
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
So I can build my entire app. Just can not use ROOM.
This worked for Dev05 but now Dev07/Dev08 is broken
l
It didn’t actualy work under dev05, the failure cases were just slightly harder to hit, so things were kind of “accidentally” working for you. Unfortunately, using ROOM in the same module as compose is currently not working. This is not intentional, but just a side effect of the kotlin annotation processing pipeline not working for the kotlin IR backend yet. It actually does work in upstream kotlin, but we are still working on rebasing on top of it so that those things work.
a
Oh ... Thank you so much @Leland Richardson [G] for the clarification !!!