android – Youtube API“初始化YouTube播放器时出错.”

android – Youtube API“初始化YouTube播放器时出错.”,第1张

概述我使用Youtube API在我的应用程序上拥有简单的playerView.我做了API所说的做法,但是我不断得到“应用程序停止”的消息.自从我使用韩国电话以来,我并不知道确切的英文短语.希望这是正确的英文短语. 我将Youtubeandroidplayerapi.jar放在libs中,并构建了路径,并在库中添加了不必要的组件. 这是Menu.java. package com.hobak.sci 我使用Youtube API在我的应用程序上拥有简单的playerVIEw.我做了API所说的做法,但是我不断得到“应用程序停止”的消息.自从我使用韩国电话以来,我并不知道确切的英文短语.希望这是正确的英文短语.

我将YoutubeandroidplayerAPI.jar放在libs中,并构建了路径,并在库中添加了不必要的组件.

这是Menu.java.

package com.hobak.sci;import com.hobak.sci.DeveloperKey;import com.hobak.sci.R;import com.Google.androID.youtube.player.YouTubeBaseActivity;import com.Google.androID.youtube.player.YouTubeInitializationResult;import com.Google.androID.youtube.player.YouTubePlayer;import com.Google.androID.youtube.player.YouTubePlayer.ProvIDer;import com.Google.androID.youtube.player.YouTubePlayerVIEw;import androID.os.Bundle;public class Menu extends YouTubeBaseActivity implements    YouTubePlayer.OnInitializedListener {    @OverrIDe    public voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.menu);        YouTubePlayerVIEw youTubeVIEw = (YouTubePlayerVIEw) findVIEwByID(R.ID.youtube_vIEw);    youTubeVIEw.initialize(DeveloperKey.DEVELOPER_KEY,this);    }    @OverrIDe    public voID onInitializationSuccess(YouTubePlayer.ProvIDer provIDer,YouTubePlayer player,boolean wasRestored) {    if (!wasRestored) {        player.cueVIDeo("2LHv1FPd1Ec");    }}protected YouTubePlayer.ProvIDer getYouTubePlayerProvIDer() {    return (YouTubePlayerVIEw) findVIEwByID(R.ID.youtube_vIEw);}@OverrIDepublic voID onInitializationFailure(ProvIDer arg0,YouTubeInitializationResult arg1) {    // Todo auto-generated method stub}}

这里是我的xml文件

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    androID:background="#FFFACD"    androID:orIEntation="vertical" >  <com.Google.androID.youtube.player.YouTubePlayerVIEw    androID:ID="@+ID/youtube_vIEw"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent" /></linearLayout>

这是我的logcat

03-17 15:55:51.260: E/AndroIDRuntime(5277): FATAL EXCEPTION: main03-17 15:55:51.260: E/AndroIDRuntime(5277): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hobak.sci/com.hobak.sci.Menu}: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.Google.androID.youtube.API.service.START }03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1961)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ActivityThread.access0(ActivityThread.java:128)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1152)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.os.Handler.dispatchMessage(Handler.java:99)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.os.Looper.loop(Looper.java:137)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ActivityThread.main(ActivityThread.java:4453)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at java.lang.reflect.Method.invokeNative(Native Method)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at java.lang.reflect.Method.invoke(Method.java:511)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:554)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at dalvik.system.NativeStart.main(Native Method)03-17 15:55:51.260: E/AndroIDRuntime(5277): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.Google.androID.youtube.API.service.START }03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ContextImpl.bindService(ContextImpl.java:1164)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.content.Contextwrapper.bindService(Contextwrapper.java:370)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.Google.androID.youtube.player.internal.r.e(UnkNown Source)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.Google.androID.youtube.player.YouTubePlayerVIEw.a(UnkNown Source)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.Google.androID.youtube.player.YouTubeBaseActivity$a.a(UnkNown Source)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.Google.androID.youtube.player.YouTubePlayerVIEw.initialize(UnkNown Source)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at com.hobak.sci.Menu.onCreate(Menu.java:21)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.Activity.performCreate(Activity.java:4467)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)03-17 15:55:51.260: E/AndroIDRuntime(5277):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1925)03-17 15:55:51.260: E/AndroIDRuntime(5277):     ... 11 more
解决方法 我有这个问题.然后我刚刚添加

< uses-permission androID:name =“androID.permission.INTERNET”>< / uses-permission>进入< manifest>中的AndroIDManifest.xml标签.之后,该应用程序运行正常.

总结

以上是内存溢出为你收集整理的android – Youtube API“初始化YouTube播放器时出错.”全部内容,希望文章能够帮你解决android – Youtube API“初始化YouTube播放器时出错.”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1133677.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存