Failed to load WebView provider: No WebView installed [duplicate] - android

Recently, we've started seeing this new entry in our crashlytics which says that android can't find the webview package on the device.
Here's the full stacktrace (classes from our source code have been replaced with ..... :
Fatal Exception: android.view.InflateException: Binary XML file line #139: Binary XML file line #139: Error inflating class <unknown>
Caused by android.view.InflateException: Binary XML file line #139: Error inflating class <unknown>
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at g.a.a.a.d.a(SourceFile:211)
at g.a.a.a.d.a(SourceFile:20)
at g.a.a.a.d$a.onCreateView(SourceFile:302)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at g.a.a.a.d.inflate(SourceFile:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at ......(SourceFile:148)
at ......(SourceFile:119)
at ......(SourceFile:28)
at android.support.v4.view.ViewPager.a(SourceFile:1034)
at android.support.v4.view.ViewPager.a(SourceFile:1182)
at android.support.v4.view.ViewPager.c(SourceFile:1116)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1642)
at ....(SourceFile:27)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1320)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.widget.ScrollView.onMeasure(ScrollView.java:345)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1658)
at android.view.View.measure(View.java:20234)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
at android.view.View.measure(View.java:20234)
at android.support.v4.widget.DrawerLayout.onMeasure(SourceFile:1081)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:139)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
at android.view.View.measure(View.java:20234)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2659)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1600)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1873)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1485)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7078)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:910)
at android.view.Choreographer.doCallbacks(Choreographer.java:712)
at android.view.Choreographer.doFrame(Choreographer.java:646)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:896)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6369)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1088)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
Caused by android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:395)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194)
at android.webkit.WebView.getFactory(WebView.java:2592)
at android.webkit.WebView.findAddress(WebView.java:1958)
at android.text.util.Linkify.gatherMapLinks(Linkify.java:599)
at android.text.util.Linkify.addLinks(Linkify.java:287)
at android.widget.TextView.setText(TextView.java:4474)
at android.widget.TextView.setText(TextView.java:4395)
at android.widget.TextView.<init>(TextView.java:1472)
at android.widget.TextView.<init>(TextView.java:727)
at android.widget.TextView.<init>(TextView.java:723)
at me.grantland.widget.AutofitTextView.<init>(SourceFile:25)
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at g.a.a.a.d.a(SourceFile:211)
at g.a.a.a.d.a(SourceFile:20)
at g.a.a.a.d$a.onCreateView(SourceFile:302)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at g.a.a.a.d.inflate(SourceFile:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at ....(SourceFile:148)
at ....(SourceFile:119)
at ....(SourceFile:28)
at android.support.v4.view.ViewPager.a(SourceFile:1034)
at android.support.v4.view.ViewPager.a(SourceFile:1182)
at android.support.v4.view.ViewPager.c(SourceFile:1116)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1642)
at ....(SourceFile:27)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1320)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.widget.ScrollView.onMeasure(ScrollView.java:345)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1658)
at android.view.View.measure(View.java:20234)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
at android.view.View.measure(View.java:20234)
at android.support.v4.widget.DrawerLayout.onMeasure(SourceFile:1081)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:139)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
at android.view.View.measure(View.java:20234)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2659)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1600)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1873)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1485)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7078)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:910)
at android.view.Choreographer.doCallbacks(Choreographer.java:712)
at android.view.Choreographer.doFrame(Choreographer.java:646)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:896)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6369)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1088)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
Caused by android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:294)
at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:354)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194)
at android.webkit.WebView.getFactory(WebView.java:2592)
at android.webkit.WebView.findAddress(WebView.java:1958)
at android.text.util.Linkify.gatherMapLinks(Linkify.java:599)
at android.text.util.Linkify.addLinks(Linkify.java:287)
at android.widget.TextView.setText(TextView.java:4474)
at android.widget.TextView.setText(TextView.java:4395)
at android.widget.TextView.<init>(TextView.java:1472)
at android.widget.TextView.<init>(TextView.java:727)
at android.widget.TextView.<init>(TextView.java:723)
at me.grantland.widget.AutofitTextView.<init>(SourceFile:25)
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at g.a.a.a.d.a(SourceFile:211)
at g.a.a.a.d.a(SourceFile:20)
at g.a.a.a.d$a.onCreateView(SourceFile:302)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at g.a.a.a.d.inflate(SourceFile:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at ....(SourceFile:148)
at ....(SourceFile:119)
at ....(SourceFile:28)
at android.support.v4.view.ViewPager.a(SourceFile:1034)
at android.support.v4.view.ViewPager.a(SourceFile:1182)
at android.support.v4.view.ViewPager.c(SourceFile:1116)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1642)
at ....(SourceFile:27)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1320)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.widget.ScrollView.onMeasure(ScrollView.java:345)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1658)
at android.view.View.measure(View.java:20234)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
at android.view.View.measure(View.java:20234)
at android.support.v4.widget.DrawerLayout.onMeasure(SourceFile:1081)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:139)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20234)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
at android.view.View.measure(View.java:20234)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2659)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1600)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1873)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1485)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7078)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:910)
at android.view.Choreographer.doCallbacks(Choreographer.java:712)
at android.view.Choreographer.doFrame(Choreographer.java:646)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:896)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6369)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1088)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
We are seeing this on :
Android versions : 5,6,7
Devices Manufacturers: Lenovo, oneplus, samsung, motorola
And, the devices are not rooted.
After searching for a while, I am not able to find any appropriate cause (and handling) for this. Went through this question also but it doesn't have any solution.
Please help.
Edit : This is happening for a lot of our users, so I can't go and tell everyone to check/install webiew from the play store.
Is there a better solution for this?

I figured out a probable problem here. As we know that webview has been shipping as a separate app from android 5.0, it may be the case that at the time my view is being inflated, the webview package is being updated by the os and therefore it can't find the webview pacakge for those few moments. I know it's a very borderline case but
as I can see, the crash is happening on only >= 5.0 devices which support this hypothesis
it's very hard to believe that all such devices don't have webview installed. As a matter of fact, I tried uninstalling the system and chrome packages from my device but still the app doesn't crash.
So here's what I did (hacky solution but prevents crashes):
try {
// the inflating code that's causing the crash
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains("webview")) {
// If the system failed to inflate this view because of the WebView (which could
// be one of several types of exceptions), it likely means that the system WebView
// is either not present (unlikely) OR in the process of being updated (also unlikely).
// It's unlikely but we have been receiving a lot of crashes.
// In this case, show the user a message and finish the activity
}
}
Basically nothing but handling that exception. No rocket science there.

I faced the same issue in Android 12. I opened the Android System Webiew in my Play Store app and uninstalled it. After it was uninstalled I enabled it by clicking on the Enable button. That worked for me.

Please refer to this issue.
Workaround
try {
super.setText(spannableStringBuilder, type);
} catch (Exception e) {
// WebView is not installed in some devices by default, Linkify.MAP_ADDRESSES causes the exception
if (e.getMessage().contains("webview")){
setAutoLinkMask(Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS);
}
super.setText(spannableStringBuilder, type);
}

My exception is
android.webkit.WebViewFactory$MissingWebViewPackageException
Failed to load WebView provider: No WebView installed
detail stack is:
java.lang.RuntimeException:Unable to start activity ComponentInfo{cn.trinea.android.developertools/a.a.aa}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class a.a.ab
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
......
android.webkit.WebViewFactory$MissingWebViewPackageException:Failed to load WebView provider: No WebView installed
android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:270)
android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:330)
android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194)
android.webkit.WebView.getFactory(WebView.java:2325)
android.webkit.WebView.ensureProviderCreated(WebView.java:2320)
android.webkit.WebView.setOverScrollMode(WebView.java:2379)
android.view.View.<init>(View.java:4023)
android.view.View.<init>(View.java:4146)
android.view.ViewGroup.<init>(ViewGroup.java:579)
android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
android.webkit.WebView.<init>(WebView.java:627)
android.webkit.WebView.<init>(WebView.java:572)
android.webkit.WebView.<init>(WebView.java:555)
android.webkit.WebView.<init>(WebView.java:542)
solution is
public class MyWebView extends WebView {
#Override
public void setOverScrollMode(int mode) {
try {
super.setOverScrollMode(mode);
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains("Failed to load WebView provider: No WebView installed")) {
e.printStackTrace();
} else {
throw e;
}
}
}
}

According to the TextView's sourceCode
if (mAutoLinkMask != 0) {
...
if (Linkify.addLinks(s2, mAutoLinkMask)) {
...
}
}
The textview with android:autoLink property will call Linkify.addLinks (reaches the method of WebView finally) and cause the crash.
So, we can remove the android:autoLink property and realize with other way to fix the problem.

Related

How to fix crash on only Huawei devices in android.widget.SearchView

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.***.***/com.***.***.activities.SearchActivity}: android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class android.widget.SearchView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2451)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by android.view.InflateException: Binary XML file line #79: Binary XML file line #79: Error inflating class android.widget.SearchView$SearchAutoComplete
at android.view.LayoutInflater.inflate(LayoutInflater.java:558)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.widget.SearchView.inflateSearchView(SearchView.java:1847)
at android.widget.SearchView.(SearchView.java:268)
at android.widget.SearchView.(SearchView.java:259)
at android.widget.SearchView.(SearchView.java:255)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by android.view.InflateException: Binary XML file line #79: Error inflating class android.widget.SearchView$SearchAutoComplete
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.widget.SearchView.inflateSearchView(SearchView.java:1847)
at android.widget.SearchView.(SearchView.java:268)
at android.widget.SearchView.(SearchView.java:259)
at android.widget.SearchView.(SearchView.java:255)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.SearchView.isInActionMode()' on a null object reference
at android.widget.SearchView$SearchAutoComplete.enoughToFilter(SearchView.java:1801)
at android.widget.AutoCompleteTextView.doAfterTextChanged(AutoCompleteTextView.java:781)
at android.widget.AutoCompleteTextView$MyWatcher.afterTextChanged(AutoCompleteTextView.java:749)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8232)
at android.widget.TextView.setText(TextView.java:4435)
at android.widget.TextView.setText(TextView.java:4283)
at android.widget.EditText.setText(EditText.java:84)
at android.widget.TextView.setText(TextView.java:4258)
at com.mikepenz.iconics.Iconics$IconicsBuilderView.build(Iconics.java:297)
at com.mikepenz.iconics.context.IconicsFactory.onViewCreatedInternal(IconicsFactory.java:50)
at com.mikepenz.iconics.context.IconicsFactory.onViewCreated(IconicsFactory.java:27)
at com.mikepenz.iconics.context.InternalLayoutInflater$PrivateWrapperFactory2.onCreateView(InternalLayoutInflater.java:245)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:773)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.widget.SearchView.inflateSearchView(SearchView.java:1847)
at android.widget.SearchView.(SearchView.java:268)
at android.widget.SearchView.(SearchView.java:259)
at android.widget.SearchView.(SearchView.java:255)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
According to the log its happening in the oncreate of activity when trying to inflate the searchview. I am using 'android.widget.SearchView' instead of appcompat because I am animating it and can't get the appcompat version to animate properly.
I do not feel this is an animate issue though. I cannot figure out why its only happening on Huawei devices. I released this update last week and its already on 100k plus devices. According to Crashlytics its 100% Huawei and 81% Android 8, 15% Android 7 and 4% Android 6.
I have tried try/catches on the start activity, on create and few other places but nothing catches it. I can post code if needed but wanted to see if it was necessary.
Here is the searchview in the layout
<SearchView
android:id="#+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:iconifiedByDefault="false"/>
And this is initializing the searchview in oncreate
SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
if (searchManager != null) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
}
Setting setSearchableInfo is calling updateSearchAutoComplete() which is where the crash starts. But i have tried a try/catch there an still crashes.

App Running On Emulator But not running on phone?

When i am trying to install the app on my phone through USB, but it fails to open and the app stops on the splash screen. So i have tried to run the application on the emulator then it is successful and application runs.
I am new to Android unable to debug the error?So, could anyone answer to the following error?
07-04 19:45:48.009 28227-28227/com.example.dell.foodapplication E/HAL: PATH3 /odm/lib64/hw/gralloc.qcom.so
PATH2 /vendor/lib64/hw/gralloc.qcom.so
PATH1 /system/lib64/hw/gralloc.qcom.so
PATH3 /odm/lib64/hw/gralloc.msm8953.so
PATH2 /vendor/lib64/hw/gralloc.msm8953.so
PATH1 /system/lib64/hw/gralloc.msm8953.so
07-04 19:45:52.731 28227-28227/com.example.dell.foodapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.dell.foodapplication, PID: 28227
java.lang.OutOfMemoryError: Failed to allocate a 298598412 byte allocation with 14026592 free bytes and 171MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:624)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:457)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1152)
at android.content.res.ResourcesImpl.createFromResourceStream(ResourcesImpl.java:1272)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:743)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:585)
at android.content.res.MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:308)
at android.content.res.Resources.loadDrawable(Resources.java:872)
at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
at android.widget.ImageView.<init>(ImageView.java:157)
at android.widget.ImageView.<init>(ImageView.java:145)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:72)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:182)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1263)
at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1313)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1019)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:879)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
at com.example.dell.foodapplication.SelectFragment.onCreateView(SelectFragment.java:38)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2425)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2623)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2410)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2365)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2242)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:146)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1244)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1092)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1622)
at android.view.View.measure(View.java:19759)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:690)
at android.view.View.measure(View.java:19759)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2308)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1395)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1644)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1283)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6354)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:873)
at android.view.Choreographer.doCallbacks(Choreographer.java:685)
at android.view.Choreographer.doFrame(Choreographer.java:621)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:859)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6342)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Sourav Mund check the size of the drawable food_logo and let's know the size i'm guessing your OOM is coming from there

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.quentindommerc.superlistview.SuperListvie

I used more solution to solve this problem but i could not find the solution for this problems when i execute the app than app crashed and found the above exception before updating android studio its works fine but when i update the android studio 3.0 than app crashed ...please help me.
Xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
tools:context="com.tecorb.wingbemerchant.Fragments.TransportFragments.TodayFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/sort_filter_layout" />
<com.quentindommerc.superlistview.SuperListview xmlns:superlistview="http://schemas.android.com/apk/res-auto"
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
superlistview:superlv__empty="#layout/empty_view_layout"
superlistview:superlv__listClipToPadding="false"
superlistview:superlv__listDivider="#android:color/transparent"
superlistview:superlv__scrollbarStyle="outsideOverlay"/>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="10dp"
android:src="#drawable/marker"
app:backgroundTint="#color/black" />
</FrameLayout>
Layout Inflate here
#Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_today, container, false);
}
Error
FATAL EXCEPTION:
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.quentindommerc.superlistview.SuperListview
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.quentindommerc.superlistview.SuperListview
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:652)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
at com.tecorb.wingbemerchant.Fragments.TransportFragments.TodayFragment.onCreateView(TodayFragment.java:108)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1984)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1642)
at android.view.View.measure(View.java:19759)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:911)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:393)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
11-11 00:17:54.718 17196-17196/? E/AndroidRuntime: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19759)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:690)
at android.view.View.measure(View.java:19759)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2313)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1400)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1649)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1288)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6359)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:873)
at android.view.Choreographer.doCallbacks(Choreographer.java:685)
at android.view.Choreographer.doFrame(Choreographer.java:621)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:859)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6237)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x106000d type #0x1c is not valid
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2128)
at android.content.res.Resources.getLayout(Resources.java:1129)
at android.view.LayoutInflater.inflate(LayoutInflater.java:428)
at android.view.ViewStub.inflate(ViewStub.java:259)
at com.quentindommerc.superlistview.BaseSuperAbsListview.initView(BaseSuperAbsListview.java:113)
at com.quentindommerc.superlistview.BaseSuperAbsListview.<init>(BaseSuperAbsListview.java:66)
at com.quentindommerc.superlistview.SuperListview.<init>(SuperListview.java:26)
Same problem here...
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.internal.widget.ActionBarOverlayLayout
Upgraded code to android studio 3.0

ImageView in Listview throwing Exception in Android

I am trying to include the list view in tabs layout which include two texts and a image view. but it is giving following log cat. There are three tabs in my app out of which I am trying to include the listview in second and third tab. The second tab was working earlier but as I pasted the same code for the third tab with some changes it is showing following erroe The last return statement of the tab is throwing exception .I searched for similar questions but didn't got the answer. I am new at android development .
StackTrace log
Process: com.example.shubham.tabexample, PID: 32353
android.view.InflateException: Binary XML file line #56: Binary XML file line #56: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #56: Error inflating class ImageView
Caused by: android.content.res.Resources$NotFoundException: Drawable com.example.shubham.tabexample:id/imgview with resource ID #0x7f0e0094
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.shubham.tabexample:id/imgview" (7f0e0094) is not a Drawable (color or path): TypedValue{t=0x12/d=0x0 a=3 r=0x7f0e0094}
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:691)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:575)
at android.content.res.Resources.loadDrawable(Resources.java:972)
at android.content.res.TypedArray.getDrawable(TypedArray.java:931)
at android.widget.ImageView.<init>(ImageView.java:167)
at android.widget.ImageView.<init>(ImageView.java:155)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:60)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:56)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1026)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1083)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at com.example.shubham.JeevanSathi.Activity.Tab2.onCreateView(Tab2.java:28)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2239)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1332)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1574)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1641)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:794)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2200)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2153)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2034)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:651)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1239)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1087)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1613)
at android.view.View.measure(View.java:20110)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
at android.view.View.measure(View.java:20110)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6286)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:713)
07-29 13:10:38.399 32353-32353/com.example.shubham.tabexample E/AndroidRuntime: at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:785)
at android.view.View.measure(View.java:20110)
at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1080)
at android.view.View.measure(View.java:20110)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6286)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
at android.view.View.measure(View.java:20110)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6286)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:391)
at android.view.View.measure(View.java:20110)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6286)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.view.View.measure(View.java:20110)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6286)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20110)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6286)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:714)
at android.view.View.measure(View.java:20110)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2649)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1586)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1471)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7009)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:907)
at android.view.Choreographer.doCallbacks(Choreographer.java:709)
at android.view.Choreographer.doFrame(Choreographer.java:644)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6293)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1065)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:926)
Tab2.java
package com.example.shubham.JeevanSathi.Activity;
/**
* Created by Shubham on 7/25/2017.
*/
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.shubham.JeevanSathi.R;
//Our class extending fragment
public class Tab2 extends Fragment {
//Overriden method onCreateView
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//Returning the layout file after inflating
//Change R.layout.tab1 in you classes
return inflater.inflate(R.layout.tab2, container, false);
}
}
Check your drawable file if it is available then clean the code and build it. If it will not help post the xml file here

File spinner_background_material.xml does not exist (or is not a file) android xml

I get this error when try to view the xml in the editor view.
java.lang.NullPointerException
at android.graphics.Typeface.createAssetUid(Typeface.java:219)
at android.graphics.Typeface.createFromAsset(Typeface.java:193)
at com.accionplus.dbdplus.vistas.font.MaterialDesignIconsTextView.setTypeface(MaterialDesignIconsTextView.java:28)
at com.accionplus.dbdplus.vistas.font.MaterialDesignIconsTextView.<init>(MaterialDesignIconsTextView.java:22)
at com.accionplus.dbdplus.vistas.font.MaterialDesignIconsTextView.<init>(MaterialDesignIconsTextView.java:17)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:176)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:247)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:171)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:317)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:654)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:596)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:591)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
It says "Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE" but I can't figure it out. This error doesn't let me see the icons or the elements correctly in the preview of the editor.

Categories

Resources