cannot access android.support.v4.app.Fragment' a supertype of 'com.android.youtube.player.YoutubePlayerSupportFragment check module class path

Viewed 342

I'm getting an error message:

cannot access 'android.support.v4.app.Fragment' which is a supertype of 'com.android.youtube.player.YoutubePlayerSupportFragment' check your module classpath or conflicting dependencies

when I bring my courser to red underlined function call initialize() in the following code:

class Orthodontics : 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 Answers
Related