package com.example.stm; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import com.google.android.youtube.player.YouTubeInitializationResult; import com.google.android.youtube.player.YouTubePlayer; import com.google.android.youtube.player.YouTubePlayerView; public class Youtube extends AppCompatActivity { YouTubePlayerView youTubePlayerView; String adres = "https://www.youtube.com/watch?v=u8QppD8yqdc"; String toster = "Initialization failed"; String apikey = "AIzaSyDYaN0HY-2GG6BKJ4oMp0_fDmTJ2o"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_youtube); youTubePlayerView = (YouTubePlayerView) findViewById(R.id.player); YouTubePlayer.OnInitializedListener listener = new YouTubePlayer.OnInitializedListener() { @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) { youTubePlayer.loadVideo(adres); youTubePlayer.play(); } @Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) { Toast.makeText(getApplicationContext(),toster, Toast.LENGTH_SHORT).show(); } }; youTubePlayerView.initialize(apikey, listener); } }<com.google.android.youtube.player.YouTubePlayerView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/player" android:layout_centerInParent="true"/>Hello guys! I`m trying to build in youtube player in my app. This is my code. When i press button to start activity, it starts, but then stops and returns back to parent activity. Please help to find out what is wrong. Thank you.