Spanish Ejemplo de CASTY se cierra al ejecutarse.

Alejandro Viera

Member
Licensed User
El ejemplo que viene con la librería, logre compilarlo y al ejecutarse obtengo el siguiente error.
No logro descifrar que es lo que me esta generando el fallo.


Registro conectado a: motorola moto g(9) power
--------- beginning of crash
--------- beginning of main
1
** Activity (main) Resume **
Error occurred on line: 57 (Main)
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:14)
at pl.droidsonroids.casty.Casty.setUpMediaRouteMenuItem(Casty.java:193)
at pl.droidsonroids.casty.Casty.addMediaRouteMenuItem(Casty.java:120)
at de.donmanfred.Castywrapper.addMediaRouteMenuItem(Castywrapper.java:252)
at de.donmanfred.cast.main._activity_createmenu(main.java:435)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at de.donmanfred.cast.main._onCreateOptionsMenu(main.java:839)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.runHook(BA.java:190)
at de.donmanfred.cast.main.onCreateOptionsMenu(main.java:137)
at android.app.Activity.onCreatePanelMenu(Activity.java:4302)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:521)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:95)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3122)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7851)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: cannot refreshButtonSelector with null mediaRouteActionProvider
at com.google.android.gms.cast.framework.CastButtonFactory.zze(com.google.android.gmslay-services-cast-framework@@21.2.0:3)
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:11)
... 31 more
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
1
** Activity (main) Resume **
Error occurred on line: 57 (Main)
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:14)
at pl.droidsonroids.casty.Casty.setUpMediaRouteMenuItem(Casty.java:193)
at pl.droidsonroids.casty.Casty.addMediaRouteMenuItem(Casty.java:120)
at de.donmanfred.Castywrapper.addMediaRouteMenuItem(Castywrapper.java:252)
at de.donmanfred.cast.main._activity_createmenu(main.java:435)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at de.donmanfred.cast.main._onCreateOptionsMenu(main.java:839)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.runHook(BA.java:190)
at de.donmanfred.cast.main.onCreateOptionsMenu(main.java:137)
at android.app.Activity.onCreatePanelMenu(Activity.java:4302)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:521)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:95)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3122)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7851)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: cannot refreshButtonSelector with null mediaRouteActionProvider
at com.google.android.gms.cast.framework.CastButtonFactory.zze(com.google.android.gmslay-services-cast-framework@@21.2.0:3)
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:11)
... 31 more
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
1
** Activity (main) Resume **
Error occurred on line: 57 (Main)
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:14)
at pl.droidsonroids.casty.Casty.setUpMediaRouteMenuItem(Casty.java:193)
at pl.droidsonroids.casty.Casty.addMediaRouteMenuItem(Casty.java:120)
at de.donmanfred.Castywrapper.addMediaRouteMenuItem(Castywrapper.java:252)
at de.donmanfred.cast.main._activity_createmenu(main.java:435)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at de.donmanfred.cast.main._onCreateOptionsMenu(main.java:839)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.runHook(BA.java:190)
at de.donmanfred.cast.main.onCreateOptionsMenu(main.java:137)
at android.app.Activity.onCreatePanelMenu(Activity.java:4302)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:521)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:95)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3122)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7851)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: cannot refreshButtonSelector with null mediaRouteActionProvider
at com.google.android.gms.cast.framework.CastButtonFactory.zze(com.google.android.gmslay-services-cast-framework@@21.2.0:3)
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:11)
... 31 more
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
1
** Activity (main) Resume **
Error occurred on line: 57 (Main)
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:14)
at pl.droidsonroids.casty.Casty.setUpMediaRouteMenuItem(Casty.java:193)
at pl.droidsonroids.casty.Casty.addMediaRouteMenuItem(Casty.java:120)
at de.donmanfred.Castywrapper.addMediaRouteMenuItem(Castywrapper.java:252)
at de.donmanfred.cast.main._activity_createmenu(main.java:435)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at de.donmanfred.cast.main._onCreateOptionsMenu(main.java:839)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.runHook(BA.java:190)
at de.donmanfred.cast.main.onCreateOptionsMenu(main.java:137)
at android.app.Activity.onCreatePanelMenu(Activity.java:4302)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:521)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:95)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3122)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7851)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: cannot refreshButtonSelector with null mediaRouteActionProvider
at com.google.android.gms.cast.framework.CastButtonFactory.zze(com.google.android.gmslay-services-cast-framework@@21.2.0:3)
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:11)
... 31 more
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Activity (main) Create (first time) **
** Activity (main) Create (first time) **
Error occurred on line: 57 (Main)
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:14)
at pl.droidsonroids.casty.Casty.setUpMediaRouteMenuItem(Casty.java:193)
at pl.droidsonroids.casty.Casty.addMediaRouteMenuItem(Casty.java:120)
at de.donmanfred.Castywrapper.addMediaRouteMenuItem(Castywrapper.java:252)
at de.donmanfred.cast.main._activity_createmenu(main.java:435)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at de.donmanfred.cast.main._onCreateOptionsMenu(main.java:839)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.runHook(BA.java:190)
at de.donmanfred.cast.main.onCreateOptionsMenu(main.java:137)
at android.app.Activity.onCreatePanelMenu(Activity.java:4302)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:521)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:95)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3122)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7851)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: cannot refreshButtonSelector with null mediaRouteActionProvider
at com.google.android.gms.cast.framework.CastButtonFactory.zze(com.google.android.gmslay-services-cast-framework@@21.2.0:3)
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:11)
... 31 more
Error occurred on line: 57 (Main)
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:14)
at pl.droidsonroids.casty.Casty.setUpMediaRouteMenuItem(Casty.java:193)
at pl.droidsonroids.casty.Casty.addMediaRouteMenuItem(Casty.java:120)
at de.donmanfred.Castywrapper.addMediaRouteMenuItem(Castywrapper.java:252)
at de.donmanfred.cast.main._activity_createmenu(main.java:435)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at de.donmanfred.cast.main._onCreateOptionsMenu(main.java:839)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.runHook(BA.java:190)
at de.donmanfred.cast.main.onCreateOptionsMenu(main.java:137)
at android.app.Activity.onCreatePanelMenu(Activity.java:4302)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:521)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:95)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3122)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7851)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: cannot refreshButtonSelector with null mediaRouteActionProvider
at com.google.android.gms.cast.framework.CastButtonFactory.zze(com.google.android.gmslay-services-cast-framework@@21.2.0:3)
at com.google.android.gms.cast.framework.CastButtonFactory.setUpMediaRouteButton(com.google.android.gmslay-services-cast-framework@@21.2.0:11)
... 31 more
** Activity (main) Pause, UserClosed = true **
 

TheFalcon

Active Member
Licensed User
Longtime User
Ponlo entre <code> para que se lea mejor, pero el problema es siempre el mismo y te lo viene dando en la linea 57 , del MAIN
Si pones un ejemplo de esa parte del código seria mucho mas util
 

Alejandro Viera

Member
Licensed User
B4X:
Sub Activity_CreateMenu(Menu As ACMenu)
    Menu.Clear
    casty.addMediaRouteMenuItem(Menu)
    Menu.Add(2, 4, "Overflow2", Null)
    Menu.Add(3, 5, "Overflow3", Null)
End Sub

La linea 57 de MAIN es casty.addMediaRouteMenuItem(Menu)
 

drgottjr

Expert
Licensed User
Longtime User
en cuanto a:
java.lang.IllegalArgumentException: menu item with ID 2131296367 doesn't have a MediaRouteActionProvider.
yo no veo referencia a MediaRouteActionProvider en su manifiesto. hay un "proveedor" mencionado, eso si,
pero es posible que no sea el necesitado.

mira. desde la documentacion acerca de cast:
"IllegalArgumentException: If menu doesn't contain a menu item with menuResourceId identifier,
or the menu item doesn't have a MediaRouteActionProvider." o sea, tu error.
este error es conocido (si lo buscas en google) y ya pensado por parte de android.

creo que vas a tener que quitarle el polvo a tu dominio del ingles para resolver esto. el autor del
"envoltorio" de la libreria no habla espanol, y la ha creado hace ya mucho tiempo. android ha
cambiado bastante desde 2019. el arreglo podria ser facil o bien requiere muchos ajustes al codigo.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…