I've just pasted this file in a new project, but I'm getting:
Cannot resolve symbol FragmentCompat;
You need to add support library v13.
Android also you need you need to add support library
support-v13 depends on
More information you can find here