I am getting this random exceptions on some devices. I wonder what I am doing wrong. Please let me know what more information I can provide for this issue. I am clueless what else I can provide to help make this question more useful. I am getting no hints from my app.
0 java.lang.RuntimeException: Unable to create service com.google.android.gms.cast.framework.media.MediaNotificationService: java.lang.IllegalStateException: The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.
1 at android.app.ActivityThread.handleCreateService(ActivityThread.java:2474)
2 at android.app.ActivityThread.access$1600(ActivityThread.java:130)
3 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
4 at android.os.Handler.dispatchMessage(Handler.java:99)
5 at android.os.Looper.loop(Looper.java:137)
6 at android.app.ActivityThread.main(ActivityThread.java:4847)
7 at java.lang.reflect.Method.invokeNative(Native Method)
8 at java.lang.reflect.Method.invoke(Method.java:535)
9 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11 at dalvik.system.NativeStart.main(Native Method)
12 Caused by: java.lang.IllegalStateException: The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.
13 at com.google.android.gms.cast.framework.CastContext.zzbd(Unknown Source)
14 at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source)
15 at com.google.android.gms.cast.framework.media.MediaNotificationService.onCreate(Unknown Source)
16 at android.app.ActivityThread.handleCreateService(ActivityThread.java:2458)
17 ... 10 more
18 java.lang.IllegalStateException: The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.
19 at com.google.android.gms.cast.framework.CastContext.zzbd(Unknown Source)
20 at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source)
21 at com.google.android.gms.cast.framework.media.MediaNotificationService.onCreate(Unknown Source)
22 at android.app.ActivityThread.handleCreateService(ActivityThread.java:2458)
23 at android.app.ActivityThread.access$1600(ActivityThread.java:130)
24 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
25 at android.os.Handler.dispatchMessage(Handler.java:99)
26 at android.os.Looper.loop(Looper.java:137)
27 at android.app.ActivityThread.main(ActivityThread.java:4847)
28 at java.lang.reflect.Method.invokeNative(Native Method)
29 at java.lang.reflect.Method.invoke(Method.java:535)
30 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
31 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
32 at dalvik.system.NativeStart.main(Native Method)
Edit - ManifestFile
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mcruiseon.buseeta">
<!-- For Options menu call support -->
<uses-permission android:name="android.permission.CALL_PHONE"/>
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- For the background service to run forever -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- For Current Location on Driver App -->
<permission
android:name="${manifestApplicationId}.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="${manifestApplicationId}.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- For QR Code -->
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.Camera"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<!-- Google Cloud Messaging -->
<uses-permission
android:name="${manifestApplicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:name="com.mcruiseon.buseeta.InitializingApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${mapsKey}"/>
<activity
-- MY ACTIVITIES --
</activity>
</application>
</manifest>
Your app is attempting to connect to the MediaNotificationService somewhere, which relies on the Google Cast SDK. You need to create a class that extends OptionsProvider. Then, you need to register the class you created in your Manifest, like this:
<application>
...
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.example.myapp.CastOptionsProvider" />
</application>
Information on this can be found here: https://developers.google.com/cast/docs/android_sender_integrate#initialize_the_cast_context
public class CastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context appContext) {
}
}
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.example.app.CastOptionsProvider" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With