javaandroid-studioclassgoogle-codelab

building my first app with codelabs having some trouble


I am starting to learn java and use the android studio app to create my own application but after I did all the steps the final step is not working and the app is given me an error "cannot find symbol class navArgs' in the first and the second fragment.java can you please check the code since I was just copying it and pasting without any changes the error is in task 9 step 7screenshot


Solution

  • delete

    import androidx.navigation.fragment.navArgs;
    

    change dependencies from build.gradle(Module:)

    dependencies {
            classpath "com.android.tools.build:gradle:7.0.3"
            def nav_version = "2.3.5"
            classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    

    change count initialization to

    Integer count = SecondFragmentArgs.fromBundle(getArguments()).getMyarg();
    

    (small A in getMyarg())