Before adding:
1. Click this button on the project
2. Dependencies->app->Library Dependency
3. After searching and selecting the appropriate package, OK,
if the gradle is still gray,
select the project view and
change the two values of gradle.properties to false
Switch back to the android view and click Sync immediately. The
dependency import is successful.
If the incompatible types:required:androidx.fragment.app.fragmentManager...error occurs during synchronization, add the following to the manifest file:
android:appComponentFactory=""
tools:replace="android:appComponentFactory"
If getSupportFragmentManager() still has an error, pay attention to the following three points:
1. Inherit FragmentActivity
2. Define FragmentManager to android.support.v4.app.FragmentManager
3. Change the method getFragmentManager() to getSupportFragmentManager()