Closed jedashford closed 6 years ago
Hey Jed! What version of React Native are you using?
Howdy! "react-native": "0.55.4"
I'm 2 weeks new to react, but 5 years deep into Android. It appears that React made a breaking change and the @Override needs to be removed (which fixed my build issue). BUT looks like I cannot extend GoogleCastActivity as the MainActivity is extending ReactActivity. I'm trying now to initialize CastContext.getSharedInstance(this)
but I don't appear to have access to the context in MainActivty which is weird since ReactActivity extends Activity...
Final error may help lead me to the issue...
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.googlecast.GoogleCastOptionsProvider" on path: DexPathList[[zip file "/data/app/com.vidangel-3TPkPUmsgEtfVDCE2bvooA==/base.apk"],nativeLibraryDirectories=[/data/app/com.vidangel-3TPkPUmsgEtfVDCE2bvooA==/lib/x86, /data/app/com.vidangel-3TPkPUmsgEtfVDCE2bvooA==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)```
Yeah, there are some breaking changes in 0.55 (unfortunately not so uncommon with RN releases). Funny thing is @override on that method wasn't required before I think RN 0.40 :)
MainActivity needs to extend GoogleCastActivity for the Cast SDK to work (read the bottom of https://github.com/flextv/react-native-google-cast#android-setup). I think the GoogleCastOptionsProvider
error is caused by that. I'm not sure when I'll have more time to look into this; if you find a solution please feel free to open a pull request.
Actually, the GoogleCastOptionsProvider is defined by this library. I'd check whether you compile it properly. Check the example project for how to configure gradle.
Apparently I'm new to npm also...
npm install flextv/react-native-google-cast
NOT
npm install react-native-google-cast
I think that did it. Figured it out when inspecting the npm package because the files were missing on install :) Thanks for being engaged. We're hopeful to use this and have a ton of customers on chromecast. We'll certainly help maintain it if we push to production.
Oh yeah, we haven't published this new version on npm yet. Hopefully, I'll have some time to finish it soon (but you know, startups...)
So the @override is okay to be left as is?
I believe so, working through some other issues to get an initial test, but I don't see any build issues after a clean install.
Great!
After following the instructions for only Android. I get this when building. Confirmed that build works before changes. I've reverted the install and tried again from fresh. Get stuck on this every time.
:react-native-google-cast:javaPreCompileDebug UP-TO-DATE /node_modules/react-native-google-cast/android/src/main/java/com/googlecast/GoogleCastPackage.java:29: error: method does not override or implement a method from a supertype @Override ^ 1 error :react-native-google-cast:compileDebugJavaWithJavac FAILED