Thread
#compose
    a

    allan.conda

    2 years ago
    In my project Android Studio 4.2C2 can’t resolve to Component.setContent because of AppCompatActivity. I digged and AS is weirdly referring to fragment 1.0.0 instead of at least 1.1.0. This runs fine however so it means it’s probably just an IDE error. I checked the dependency graph and it seems all Fragment should use the latest version 1.0.0 -> 1.2.4 Now I don’t know if it’s an AS Preview, Gradler, or Compose issue. Looking for workarounds and some explanation here…
    i

    Ian Lake

    2 years ago
    AppCompat does use an older version of Fragments (even the latest is using Fragment 1.1.0). Do you have an explicit dependency on Fragment 1.2.X?
    a

    allan.conda

    2 years ago
    Thanks for your quick response!
    AppCompat does use an older version of Fragments
    Yep, but this line should at least work from 1.1.0 (changed FragmentActivity extends androidx.core.app.ComponentActivity into androidx.activity.ComponentActivity; The setContent extension is defined on the latter) And yes it seems the app is using 1.2.4 on runtime based on the dependency graph and it’s running fine. Right now my workaround is just use ComponentActivity directly instead of AppCompatActivity, but I’m not sure that’s the right way. The codelab tut is extending AppCompatActivity
    🤔 weirdly listing all versions of dependencies
    Andrey Kulikov

    Andrey Kulikov

    2 years ago
    if you are going to only use compose ui and not Views in this activity it is completely fine to use ComponentActivity
    a

    allan.conda

    2 years ago
    ok digged a bit, looks like an Android Studio not compose.
    if you are going to only use compose ui and not Views in this activity it is completely fine to use ComponentActivity
    good to know! I’ll go ahead with this for now. Thanks