importing Fragment and FragmentTransaction error


when I am trying to import these two lines in my code
showing error like cannot resolve symbol fragment.


Did you declare the dependencies in the Gradle?

It´s the first thing you need to do before an import.

Try this:

dependencies {

// Java language implementation
    implementation "androidx.fragment:fragment:$fragment_version"
// Kotlin
    implementation "androidx.fragment:fragment-ktx:$fragment_version"

And check out this link! Fragments Info

Answered By – L3G3ND

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published