question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change from CordovaWebView to SystemWebView in latest Cordova not working

See original GitHub issue
I stuck in my old version Android App based on Codova
I updated My Android App to latest version android@7.0.0

Now where i used CordovaWebView for for Webview in my app as follows

<org.apache.cordova.CordovaWebView
         android:id="@+id/cordovaWebCallWebView"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />

but it’s not present in latest version of Cordova. So I changed to it by below lines

 <org.apache.cordova.engine.SystemWebView
 android:id="@+id/SystemWebView"
 android:layout_width="match_parent"
 android:layout_height="match_parent" />

where i am using WebRtc for my App So I used following method of SystemWebView Class

cwv.setWebChromeClient(new WebChromeClient() {

            @Override
            public void onPermissionRequest(final PermissionRequest request) { 
                javaToJavascript.webrtcCallLog("web.java", "permission asked is"+Arrays.deepToString(request.getResources()),0); //This logs the type of permission asked
                Log.i("The list of permission asked is ", Arrays.deepToString(request.getResources())); // this askes for android.webkit.resource.AUDIO_CAPTURE permission

                getActivity().runOnUiThread(new Runnable() {
                    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                    @Override
                    public void run() {
                        Log.i("Value Of the permission asked is ", request
                                .getOrigin().toString());

                        request.grant(request.getResources());

                    }
                });

            }
        });

Now i got runtime error in my Main java file regarding classCastException

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.simCard.web/com.simCard.web.WebCall}: java.lang.ClassCastException: com.simCard.web.WebCall$1 cannot be cast to org.apache.cordova.engine.SystemWebChromeClient

How to solve This error ? Please any ones help will be grateful

Thank you

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
brodybitscommented, Nov 13, 2018

[…] tried to reflect my findings in this update: apache/cordova-docs@6dc8836

My response is in https://github.com/apache/cordova-docs/issues/884#issuecomment-438318495. In short a pull request would be really appreciated.

I would prefer that we keep further discussion in https://github.com/apache/cordova-docs/issues/884 instead of this closed issue.

0reactions
martinhorvathcommented, Nov 13, 2018

I had a hard time with the documentation and tried to reflect my findings in this update: https://github.com/apache/cordova-docs/commit/6dc8836ff669dbd6825093740a3115cb0c08b1c2

Can somebody check if this is useful for others?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cordova not using the latest Android System Webview
After doing some research, it appears the problem stems from the Android device being 'hardcoded' to access the webview from com.android.webview ...
Read more >
Android WebViews - Apache Cordova
To follow these instructions, make sure you have the latest Cordova distribution. · Navigate to the Android package's /framework directory and run ant...
Read more >
Cordova changed its webview from org ... - Google Groups
This causes me great problems because I can not query the webview anymore. I tried to query the SystemWebView like this query("SystemWebView css:'*'")...
Read more >
Cordova Webview Schemes/Protocols - Mat's Blog
This can sometimes cause issues, perhaps you're loading in a third party script that checks window.location and uses the current protocol to ...
Read more >
Cordova-plugin-webviewselector - npm.io
Crosswalk being not maintained anymore, the future is in the use of system's webview. But on older devices you may want to keep...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found