android - 无效的应用程序 ID - chromecast

标签 android google-cast chromecast

我正在调整 Google Cast 代码,即提供的代码 here .

我已完成整个工作空间设置,但是,当尝试在 Android 手机上运行示例应用程序时,出现以下错误。

我刚刚将包名称指定为应用程序 ID。我从哪里获得应用程序 ID?我应该向 Google 注册以获得应用程序 ID 吗?它是如何工作的?

02-13 23:36:00.995: E/AndroidRuntime(8310): FATAL EXCEPTION: main
02-13 23:36:00.995: E/AndroidRuntime(8310): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.sample.cast.refplayer/com.google.sample.cast.refplayer.VideoBrowserActivity}: java.lang.IllegalArgumentException: Invalid appliation ID: com.google.sample.cast.refplayer
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.os.Looper.loop(Looper.java:137)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.ActivityThread.main(ActivityThread.java:4511)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at java.lang.reflect.Method.invokeNative(Native Method)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at java.lang.reflect.Method.invoke(Method.java:511)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at dalvik.system.NativeStart.main(Native Method)
02-13 23:36:00.995: E/AndroidRuntime(8310): Caused by: java.lang.IllegalArgumentException: Invalid appliation ID: 
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.android.gms.cast.CastMediaControlIntent.a(Unknown Source)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.android.gms.cast.CastMediaControlIntent.categoryForCast(Unknown Source)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.sample.castcompanionlibrary.cast.BaseCastManager.<init>(BaseCastManager.java:183)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.sample.castcompanionlibrary.cast.VideoCastManager.<init>(VideoCastManager.java:215)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.sample.castcompanionlibrary.cast.VideoCastManager.initialize(VideoCastManager.java:168)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.sample.cast.refplayer.CastApplication.getCastManager(CastApplication.java:51)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at com.google.sample.cast.refplayer.VideoBrowserActivity.onCreate(VideoBrowserActivity.java:55)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.Activity.performCreate(Activity.java:4470)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
02-13 23:36:00.995: E/AndroidRuntime(8310):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
02-13 23:36:00.995: E/AndroidRuntime(8310):     ... 11 more
02-13 23:36:01.115: D/dalvikvm(8310): GC_CONCURRENT freed 168K, 3% free 13426K/13831K, paused 7ms+7ms
02-13 23:36:01.305: I/Process(8310): Sending signal. PID: 8310 SIG: 9

最佳答案

最好的方法是创建自己的接收器(Styled Media Receiver)。当你注册它时,你会得到一个应用程序 ID;我建议你去Cast developers网站并熟悉 Chromecast 及其工作原理。获得 App Id 后,您需要将其插入到 YOUR_APP_ID 字符串所在的 res/values/string.xml 中。

关于android - 无效的应用程序 ID - chromecast,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21771652/

相关文章:

ios - 将 Google Cast SDK 添加到 64 位版本

ios - Chromecast 获取音量

带 HLS (.m3u8) 的 chromecast 隐藏式字幕

ios - session 开始后应如何处理断开连接的设备?

java - 在 AsyncTask 中使用回调函数时出现 NullpointerException

android - 与 ChromeCast 断开连接不会停止视频播放

java - 如何掌握android开发?

google-cast - Chromecast 用户代理

java - Android ObjectAnimator 与 ViewPropertyAnimator

java - Eclipse 中 Gradle 的协助