无法访问com.android.youtube.player.YoutubePlayerSupportFragment检查模块类路径的超类型android.support.v4.app.Fragment

时间:2020-06-12 19:43:42

标签: android kotlin fragment

我收到错误消息: 无法访问“ android.support.v4.app.Fragment”,它是“ com.android.youtube.player.YoutubePlayerSupportFragment”的超类型,请检查您的模块类路径或相互依赖的依赖关系

当我在以下代码中将课程向导带红色下划线的函数调用 initialize()时。

正畸类:AppCompatActivity(){

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_orthodontics)
    val youtubefragment= supportFragmentManager.findFragmentById(R.id.fragment2) as YouTubePlayerSupportFragment
    youtubefragment.initialize("AIzaSyB-5LPG4MIHD1XDb56azVDZYmTfd2o",object: YouTubePlayer.OnInitializedListener{
        override fun onInitializationSuccess(p0: YouTubePlayer.Provider?,p1: YouTubePlayer?,p2: Boolean) {
            if(p1==null) return
            if(p2) {
                p1.play()
            } else {
                p1.cueVideo("gh1p3TGlf8c&t=05")
                p1.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT)
            }

        }

        override fun onInitializationFailure(p0: YouTubePlayer.Provider?,p1: YouTubeInitializationResult?) {
            TODO("Not yet implemented")
        }

    })

}

}

0 个答案:

没有答案