Android: Cast SDK v3 Crashing in Release build only

你说的曾经没有我的故事 提交于 2019-12-23 17:40:23

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/39257813/android-cast-sdk-v3-crashing-in-release-build-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!