-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"API Not Initialized" error in --release build only #16
Comments
That is interesting. o.o Can you give more details? (stack trace?) |
It is hard to get debug output because it's a release version, so the usual way I have to get some output does not work (chrome devices). Any hint on how I could get some additional info on a release build? |
Oh right, of course, silly me.
Hmm that is a quite a bit more challenging then indeed.
I guess you could get the js stack trace by directly placing printing the info to the html, but that probably won’t be that helpful I guess. :/
You could try stripping down your app, or just doing the bare minimum to test chrome cast on a fresh hello world cordova project (with your release config), and see if you get error.
Just replying by email, (can’t see the original post), is it happening on both ios and android release?
On Mar 1, 2021, at 01:11, enricodente <[email protected]<mailto:[email protected]>> wrote:
It is hard to get debug output because it's a release version, so the usual way I have to get some output does not work (chrome devices).
Any hint on how I could get some additional info on a release build?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMLADY637ZM2ZXCQGUOSJ2TTBND2NANCNFSM4YLDTUKA>.
|
This happens for Android release only, on iOS I have the release up and running on App Store with no issues whatsoever. So I assume you are not having the same issue in release builds on Android, correct? I will try a minimal app to check whether the problem comes from my build setup or other plugins/elements in my current project. |
That is strange.
Yeah, it’s fine for me. Or... hmm... actually I might have only released the ios version of my app since the last update I made to chromecast. Not sure.
Recently I updated the plugin’s chromecast SDK version (for android and ios I’m pretty sure).
I wonder if maybe there is a problem with the newest chromecast sdk version.
You could try the previous version of the plugin that has the older SDK. (or, try modifying the sdk version number in plugin.xml directly yourself.)
On Mar 2, 2021, at 11:31, enricodente <[email protected]<mailto:[email protected]>> wrote:
This happens for Android release only, on iOS I have the release up and running on App Store with no issues whatsoever.
So I assume you are not having the same issue in release builds on Android, correct?
I will try a minimal app to check if the problem comes from my build setup or other plugins/elements in my current project.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMLADY6WDPEVI4GSG3J5FXLTBUVGFANCNFSM4YLDTUKA>.
|
That is a good point. I will try that for sure, this weekend I will be able to test. I will try with 4.4.6 (October 2020) and see if that helps. |
Still no luck. I've been trying for quite a while today experimenting with different versions of SDK too (reverted up to 17.0). Also tried adding some dependencies that were removed back. Tried both on a Xiaomi device (Android 10) and an AOSP device (Android 9), same results. Debug build works perfectly fine, release will fail to initialize. AFAIK the main difference between debug and release build is on debug logs and connection blocking (release version will follow more strictly connection blocking rules). I have guessed it might have to do with a connection issue to Google servers, at init stage, as the plugin is looking to access my custom receiver, but I even tried to add for test purposes, the error still persists. Are you able to have a test to check whether the issue can be replicated or not? |
This is interesting, definitely sounds like a promising route. I think this issue is actually happening for me too. (I just have too much on my plate and didn't notice >.<) Our Sentry has a bunch of errors related to chromecast init, and it's only happening on android devices. Unfortunatley, the error logging isn't set up completely correctly and I'm just getting "failed to init [Object object]" I will investigate more. I've updated the log, hopefully I will get better info back. I will see if I can find out when this error started and correlate it with changes. Will post back in a couple hours! |
Since it looks like the native code for
This is where The Full flow:
The only thing that looks like it could actually barf is that maybe The only way There are a number of things that could go wrong here.... Unfortunately that's all the time I have for digging today... If we had access to the native logs when running in release mode and the error happens that would be interesting. The only other thing I can think to try right now is to:
|
I successfully applied your changes on the error reporting and now I correctly get the whole details from the error. Then following the stack trace, I get to the same result as you explained super clearly in your previous post, but I am not so skilled to work on the Java portion of the code. What I can tell you is that I tried to remove the check on chrome.cast.isAvailable, and of course it returns another error, so there is actually an issue to be solved at init/setup phase. If you could try to trace the error back in the code, I can still try to analyze what's happening in the code to find out which section could be involved in differences between debug and release builds. Thank you very much for your commitment! |
Hi Lindsay, I was thinking of all the extra stuff happening when switching from debug to release, and I finally found the issue reading the official Google Docs, assuming you have Proguard plugin installed. First test I did: uninstall Proguard plugin, and Chromecast starts working in release. Unless you are not using Proguard, I would say the issue should be close to be solved! |
Oh dang. Nice research Enrico!
(also thanks for testing the other stuff, I was actually curious what would happen if we just skipped that check :p)
I’m not actually sure if we are using proguard or not. It sounds a bit familiar, but I don’t remember installing it off the top of my head. Will have to check! (But I am super busy with other things, so it probably won’t happen right away, so feel free to close this issue)
A note in the documentation about this sounds like a very good idea!
Maybe under an Android Quirks section? Will definitely accept a PR for that!
On Mar 9, 2021, at 00:40, enricodente ***@***.******@***.***>> wrote:
Hi Lindsay,
I was thinking of all the extra stuff happening when switching from debug to release, and I finally found the issue reading the official Google Docs, assuming you have Proguard plugin installed.
Reference: https://developers.google.com/cast/docs/android_sender#other-ide
First test I did: uninstall Proguard plugin, and Chromecast starts working in release.
Second and final test: add proguard-custom.txt in the project root folder, with the content showed in the documentation linked above, and Chromecast keeps working in release.
Unless you are not using Proguard, I would say the issue is solved!
It might be worth to update the documentation for the plugin to warn about this compatibility issue, and how to solve it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMLADY7QVD5STC46MFPM5VDTCXGHXANCNFSM4YLDTUKA>.
|
https://www.npmjs.com/package/cordova-plugin-proguard |
Platform: Android
Cordova: 10.0.0
While compiling --debug version, everything works fine.
Only when compiled as --release I get this error at app startup, when initializing Chromecast plugin, of course anything related to Chromacast is not working after the error.
Anyone else experienced this issue?
The text was updated successfully, but these errors were encountered: