0

Please I have checked for possible solution but unable to find any. I have a web view app which I start new activity in onCreate, everything is working fine on other android Android 6.0 and above, you on Android Version 5.0 Huawei my app crashed with bellow errors.

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if(!AppController.getInstance(this).getHandShake()) {
            //At first launching
            Intent gettingStarted = new Intent(MainActivity.this, GettingStarted.class);
            gettingStarted.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            this.startActivity(gettingStarted);
        }
        //Continue loading website url in main activity
         if (savedInstanceState != null) {
            webviewapp.restoreState(savedInstanceState);
        }else{
            webviewapp.setWebViewClient(new MainActivity.customWebViewClient());
            webviewapp.setWebChromeClient(new MainActivity.customWebChromeClient());
            appLoadUrl("https://example.com", false);
        }
 }

Am not unable to figure out what the problem is.

FATAL EXCEPTION: main
Process: com.application.example, PID: 27705
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.application.example/com.application.example.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2406)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2466)
    at android.app.ActivityThread.access$1200(ActivityThread.java:152)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5538)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
    at android.view.LayoutInflater.createView(LayoutInflater.java:652)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at com.android.internal.policy.impl.HwPhoneLayoutInflater.onCreateView(HwPhoneLayoutInflater.java:75)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:701)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:760)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:825)
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:935)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:523)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:425)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:368)
    at b.b.k.k.l()
    at b.b.k.h.setContentView()
    at com.application.example.MainActivity.onCreate()
    at android.app.Activity.performCreate(Activity.java:6013)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
    ... 10 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:626)
    ... 26 more
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x3040002
    at android.content.res.HwResources.getText(HwResources.java:1252)
    at android.content.res.Resources.getString(Resources.java:374)
    at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(ContentViewCore.java:948)
    at com.android.org.chromium.content.browser.ContentViewCore.initialize(ContentViewCore.java:848)
    at com.android.org.chromium.android_webview.AwContents.createAndInitializeContentViewCore(AwContents.java:649)
    at com.android.org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:788)
    at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:635)
    at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:573)
    at com.android.webview.chromium.WebViewChromium.initForReal(WebViewChromium.java:315)
    at com.android.webview.chromium.WebViewChromium.access$100(WebViewChromium.java:100)
    at com.android.webview.chromium.WebViewChromium$1.run(WebViewChromium.java:267)
    at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.drainQueue(WebViewChromium.java:127)
    at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue$1.run(WebViewChromium.java:114)
    at com.android.org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:144)
    at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.addTask(WebViewChromium.java:111)
    at com.android.webview
Peter
  • 1,860
  • 2
  • 18
  • 47
  • There appears to be some issue with `WebView` on that device. It is unlikely to be related to your code. Make sure that the device has all available updates applied. – CommonsWare Jul 18 '20 at 19:58
  • 1
    This will help you [this](https://stackoverflow.com/a/57968071/5417056) – Murtadha S. Jul 18 '20 at 20:23

0 Answers0