[Error][CC3.3] Game Crash on Webview's onJsCallback

Background: We are migrating our CC 2.1 project to CC3.3 and we found out that game kept crashing when a certain webview was loaded. After tracing down the errors, it was due to Webview’s onJsCallback.

To replicate, we can simply follow the official guide and the app will crash when JS interface scheme is loaded (eg: testkey://a=1&b=2 ).

Tested with both CC 3.3 and 3.2.

Example Project Attached: WebViewError.zip (31.0 KB)

@zzf_Cocos @slackmoehrle

We would appreciate if you could follow up with this issue ASAP.
Many thanks in advance.

Edit: Issue reported as well:

OK. I can ask engineering to take a look. Thank you for creating the GitHub issue and uploading a demo.

1 Like

Thanks @slackmoehrle

If they are busy, just guide me which file to fix.
I will be very happy to contribute :slightly_smiling_face:

On the other hand, project deadline is due in next 2 weeks. :sob:

Thanks for the feedback, I can reproduce this crash problem on your demo. version 3.3.0
Please try to modify this, and then try to see if it works.
CocosWebView.java line 156

CocosHelper.runOnGameThread(new Runnable() {
                  @Override
                  public void run() {
                      CocosWebViewHelper._didFailLoading(mViewTag, failingUrl);
                  }
              });

Thanks! I will give it a try tonight and will get back to you :slight_smile:

Sorry. I could not fix it :frowning:
Might be I was fixing the wrong file?

Is that the right path?
/Applications/CocosCreator/Creator/3.3.0/CocosCreator.app/Contents/Resources/resources/3d/engine-native/cocos/platform/android/java/src/com/cocos/lib

i haved replied in Github.

1 Like

Did you manage to fix it?

The issue was closed in GitHub but was it fixed?

@jare @Koei

replace this file CocosWebView.java.zip , and try