I simply use YoutubePlayer within one of my Tab Fragments, but couldn't integrate it!
With this code, it gives me this error.
Binary XML file line #0: Error inflating class com.google.android.youtube.player.YouTubePlayerView
                                                                       Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.google.android.youtube.player.YouTubePlayerView
Here is my Fragment class.
public class Frag_Trailer extends Fragment {
    YouTubePlayerView mYouTubePlayerView;
    YouTubePlayer.OnInitializedListener mOnInitializatedListener;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView =  inflater.inflate(R.layout.fragment_trailer, container, false);
        mYouTubePlayerView = (YouTubePlayerView)rootView.findViewById(R.id.view_youtube);
        mYouTubePlayerView.initialize(YouTubeConfig.getYoutubeApiKey(), mOnInitializatedListener);
        mOnInitializatedListener = new YouTubePlayer.OnInitializedListener() {
            @Override
            public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
                youTubePlayer.loadVideo("_XgQA9Ab0Gw");
            }
            @Override
            public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
            }
        };
        return rootView;
    }
}
Here are the dependencies that I have in build.gradle.
dependencies { 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7:23.3.0' 
    implementation 'com.android.support:design:23.3.0' 
    implementation files('libs/YouTubeAndroidPlayerApi.jar') 
} 
 
     
    