是什么原因导致" RuntimeException的:二进制XML文件行#20:你必须提供一个layout_height属性"。 (ActionBarScherlock被怀疑)?你

2023-09-07 23:40:33 作者:若是爱过

我有ActionBarScherlock应用程序,我使用ACRA。我收到一些用户的崩溃报告具有以下错误:

I have app with ActionBarScherlock and I use ACRA. I receive crash reports from some users with following error:

"java.lang.RuntimeException: Binary XML file line #20: You must supply a layout_height attribute.
    at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
    at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3602)
    at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:3554)
    at android.widget.AbsListView$LayoutParams.<init>(AbsListView.java:4322)
    at android.widget.AbsListView.generateLayoutParams(AbsListView.java:4116)
    at android.widget.AbsListView.generateLayoutParams(AbsListView.java:74)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
    at android.webkit.WebTextView$AutoCompleteAdapter.getView(WebTextView.java:650)
    at android.widget.AbsListView.obtainView(AbsListView.java:1430)
    at android.widget.AutoCompleteTextView$DropDownListView.obtainView(AutoCompleteTextView.java:1548)
    at android.widget.ListView.measureHeightOfChildren(ListView.java:1216)
    at android.widget.AutoCompleteTextView.buildDropDown(AutoCompleteTextView.java:1376)
    at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1140)
    at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:1022)
    at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:1005)
    at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3717)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
    at dalvik.system.NativeStart.main(Native Method)"

当然,我试着google一下,发现它是最有可能造成ActionBarScherlock(我注意到,谁与此错误遇到的每一个用户使用的Andr​​oid 2.3。*),但还没有找到一个解决方案。这是一个有点不安,我不能在我自己的2.3重现此错误。*设备...

Of course I've tried to google it and found that it is most likely caused by ActionBarScherlock (and I noticed that every user who encountered with this error uses android 2.3.*) but haven't found a solution. It's a bit disconcerting that I can't reproduce this error on my own 2.3.* device...

那么,是什么原因导致这个错误?

So, what causes this error?

推荐答案

我们的一个#1崩溃从这个问题来了,尤其是对中兴通讯的设备。虽然动作条上的大多数屏幕的工作,我们在用户交互与网页视图EDITTEXT /输入框得到这个崩溃。该事故发生作为web视图自动完成的结果。禁用自动完成似乎消除了崩溃。为什么自动完成应该有什么做的动作条仍是一个谜。

One of our #1 crashes came from this issue, especially on ZTE devices. While the actionbar worked on most screens, we were getting this crash when users interacted with a Webview Edittext/InputBox. The crash happened as a result of autocomplete on the Webview. Disabling autocomplete seemed to eliminate the crashes. Why autocomplete should have anything to do with the Actionbar is still a mystery.

下面,我们禁用自动完成只是为中兴通讯的设备。我们可以展开列表以后,如果我们在其他设备上的问题。

Here we disable the autocomplete just for ZTE devices. We may expand the list later if we have problems on other devices.

    public static boolean disableWebViewAutoCompleteForDevicesThatCrash(WebView webView)
{
    // We may add some other bizarre devices to this list if the ZTE fix works well.
    if ("ZTE".equals(Build.MANUFACTURER))
    {
        webView.getSettings().setSaveFormData(false);
        webView.clearFormData();
        return true;
    }
    else
    {
        return false;
    }
}