Youtube player support fragment no longer working on Android studio 3.2 (androidx)

前端 未结 6 997
梦谈多话
梦谈多话 2020-11-30 12:35

I just updated my Android Studio to version 3.2 and followed instructions to use androidx.

I\'ve been using a Youtube fragment inside a Fragment activity and everyth

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-30 12:54

    Replace .add

    transaction.add(R.id.youtube_fragment, youTubePlayerFragment).commit();
    

    with this .replace

    transaction.replace(R.id.youtube_fragment, youTubePlayerFragment).commit();
    

    and copy this class to your project folder (it may need to create the following folders)

    java -> com -> google -> android -> youtube -> player -> (here name of) YouTubePlayerSupportFragmentX.java

    then in code replace

    YouTubePlayerSupportFragment to YouTubePlayerSupportFragmentX.

提交回复
热议问题