我有一个从 Google Cast Developer 获得的有效应用程序 ID。
几天前它工作正常,但突然开始崩溃并抛出
无效的应用程序 ID:设置
这是CastOptionsProvider
我从 google cast 示例应用程序中获得的代码
public class CastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context context) {
NotificationOptions notificationOptions = new NotificationOptions.Builder()
.setTargetActivityClassName(ExpandedControlsActivity.class.getName())
.build();
CastMediaOptions mediaOptions = new CastMediaOptions.Builder()
.setNotificationOptions(notificationOptions)
.setExpandedControllerActivityClassName(ExpandedControlsActivity.class.getName())
.build();
return new CastOptions.Builder()
.setReceiverApplicationId(context.getString(R.string.app_id))
.setCastMediaOptions(mediaOptions)
.build();
}
@Override
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
return null;
}
}
这是我在我的活动中用来设置演员的代码
private void setUpCast() {
mCastStateListener = new CastStateListener() {
@Override
public void onCastStateChanged(int newState) {
if (newState != CastState.NO_DEVICES_AVAILABLE) {
showIntroductoryOverlay();
}
}
};
mCastContext = CastContext.getSharedInstance(this);//App Crashes here
}
这是我的崩溃日志:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.packagname/com.my.packagname.activities.DashboardActivity}: java.lang.IllegalArgumentException: Invalid application ID: Settings
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2667)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1494)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.IllegalArgumentException: Invalid application ID: Settings
at com.google.android.gms.cast.CastMediaControlIntent.zza(Unknown Source)
at com.google.android.gms.cast.CastMediaControlIntent.categoryForCast(Unknown Source)
at com.google.android.gms.internal.zzww.zza(Unknown Source)
at com.google.android.gms.internal.zzww.<init>(Unknown Source)
at com.google.android.gms.cast.framework.CastContext.<init>(Unknown Source)
at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source)
我通过从控制台生成新的应用程序 ID 并使用该方法尝试了不同的方法,但它仍然显示相同的错误
注意:这个应用程序几天前运行良好,使用相同的代码设置,现在它崩溃了
为什么会发生这种行为?任何帮助,将不胜感激