Whenever I try to run a release build of my app, I immediately get a crash when attempting to use any of the Google Cast features
java.lang.IllegalStateException: Failed to initialize CastContext.
Caused by: java.lang.IllegalAccessException: java.lang.Class<editpackagename.utils.CastOptionsProvider> is not accessible from java.lang.Class<com.google.android.gms.cast.framework.CastContext>
at java.lang.Class.newInstance(Native Method)
at com.google.android.gms.cast.framework.CastContext.zzbd(Unknown Source)
at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source)
at editpackagename.activities.MainActivity.onCreate(MainActivity.java:52)
That crash happens as soon as I call this in MainActivity:
CastContext castContext = CastContext.getSharedInstance(this);
If I run a debug build, everything works as expected. Using Play Services cast-framework 9.4.0.
Made CastOptionsProvider public, and that seems to have taken care of it. Not sure if it's because the class is in a subpackage or not, but looks fine. Documentation doesn't have any access modifiers.
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