Shihab Uddin
Shihab Uddin

Reputation: 6931

Application crashed when interact webview inside App: Resources$NotFoundException: Resource ID #0x0

I face application crash when i open webview & interact with inside components. This error happen only some of the specific device this time Samsung SM-A057F & Android OS 14. My other phone is working fine to run the webview & its content inside applications. So, consider it as device specific problem. So, Note that Resource ID is #0x0. That means its not from application resource file the issue has been thrown.

Crash Looks Like,

android.content.res.Resources$NotFoundException: Resource ID #0x0
    android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:250)
    android.content.res.Resources.loadXmlResourceParser(Resources.java:2622)
    android.content.res.Resources.getLayout(Resources.java:1337)
    dev.b3nedikt.restring.internal.RestringResources.getLayout(RestringResources.kt:167)
    android.view.LayoutInflater.inflate(LayoutInflater.java:542)
    android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:425)
    android.widget.ArrayAdapter.getView(ArrayAdapter.java:416)
    WV.mN.getView(chromium-TrichromeWebViewGoogle6432.aab-stable-642216633:11)
    android.widget.AbsListView.obtainView(AbsListView.java:2707)
    android.widget.ListView.measureHeightOfChildren(ListView.java:1457)
    android.widget.ListView.onMeasure(ListView.java:1363)
    android.view.View.measure(View.java:28531)
    android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7386)
    android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    android.view.View.measure(View.java:28531)
    android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7386)
    android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    android.view.View.measure(View.java:28531)
    com.android.internal.widget.AlertDialogLayout.tryOnMeasure(AlertDialogLayout.java:146)
    com.android.internal.widget.AlertDialogLayout.onMeasure(AlertDialogLayout.java:71)
    android.view.View.measure(View.java:28531)
    android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7386)
    android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    android.view.View.measure(View.java:28531)
    android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7386)
    android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    android.view.View.measure(View.java:28531)
    android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7386)
    android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    com.android.internal.policy.DecorView.onMeasure(DecorView.java:1036)
    android.view.View.measure(View.java:28531)
    android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:5126)
    android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3532)
    android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3928)
    android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3248)
    android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:11206)
    android.view.Choreographer$CallbackRecord.run(Choreographer.java:1650)
    android.view.Choreographer$CallbackRecord.run(Choreographer.java:1659)
    android.view.Choreographer.doCallbacks(Choreographer.java:1129)
    android.view.Choreographer.doFrame(Choreographer.java:1055)
    android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1622)
    android.os.Handler.handleCallback(Handler.java:958)
    android.os.Handler.dispatchMessage(Handler.java:99)
    android.os.Looper.loopOnce(Looper.java:230)
    android.os.Looper.loop(Looper.java:319)
    android.app.ActivityThread.main(ActivityThread.java:8900)
    java.lang.reflect.Method.invoke(Method.java:0)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

It is almost impossible to find the exact issue by viewing this log. I spend some hours by checking whether i have any drawables [image / xml / configuration] missmatch. But everything looks fine. Because usually this error comes from Resource File missmatach.

My webview setting is like below.

WebSettings webSettings = binding.webViewLoadProject.getSettings();
            webSettings.setJavaScriptEnabled(true);
            //webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
            webSettings.setSaveFormData(true);
            webSettings.setBuiltInZoomControls(true);
            webSettings.setAllowFileAccess(true);
            webSettings.setAllowUniversalAccessFromFileURLs(true);
            webSettings.setAllowFileAccessFromFileURLs(true);
            webSettings.setAllowContentAccess(true);
            webSettings.setDisplayZoomControls(false);
            webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
            webSettings.setDomStorageEnabled(true);

Then i load url to webview. And I also use WebViewClient & WebChromeClient.

binding.webViewLoadProject.loadUrl(pathProductDetails);
binding.webViewLoadProject.setWebViewClient(new MyWebViewClient());
binding.webViewLoadProject.setWebChromeClient(new WebChromeClient() {
 // code not pasted due to berivity
}

Upvotes: -1

Views: 97

Answers (1)

Shihab Uddin
Shihab Uddin

Reputation: 6931

I found the solution. As this is device specific problem so i searched to samsung developer portal & found some wired Solution.

The Link is here: SamsungPortal

They said: GO >

From Device Setting > Apps > Android System Webview : Uninstall this apps.

If you not found uninstall options then go to Play Store view that is linked in the bottom of Application Preview Page.

After i uninstall Android System Webview my applications is running well without crash.

But still that is unknown, how to fix it by programatically from by applications, And this is important because application users not able to do this tricks & its also give poor applicaiton performance.

I am still seeking programmatic solutions. Thanks. :

Updates: This issue still not fixed. After sometimes i faced this error again though my previous Android System Webview is uninstalled.

Upvotes: 0

Related Questions