gpt4 book ai didi

Android Youtube API 错误 YouTubePlayerView

转载 作者:可可西里 更新时间:2023-11-01 19:11:56 24 4
gpt4 key购买 nike

我正在尝试使用 Youtube API 将 youtube 视频嵌入到 android 应用程序中。我导入了 jar,将它添加到我的构建路径,并在我的主视图中添加了一个 YouTubePlayerView。在 onCreate 中,我有以下代码和我的 key ,其中 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 附带的同一个应用程序时,它似乎工作正常。有什么想法吗?

最佳答案

我想你忘了添加权限:

<uses-permission android:name="android.permission.INTERNET"/>

关于Android Youtube API 错误 YouTubePlayerView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15194184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com