我正在尝试使用Youtube API在Android应用程序中嵌入Youtube视频。我已经导入了jar包,将其添加到我的构建路径中,并在主视图中添加了一个YouTubePlayerView。在onCreate中,我有以下代码,其中xxxx是我的密钥:
YoutubePlayerView ytpv = (YouTubePlayerView) findViewById(R.id.youtubeplayer);
ytpv.initialize("xxxx", this);
当我运行应用程序时,出现异常:
java.lang.SecurityException: Not allowed to bind to service Intent { act=com.google.android.youtube.api.service.START }
当我尝试运行与API一起提供的相同应用程序时,似乎工作正常。有什么想法吗?