如何判断哪个二进制XML文件在Android中导致错误?

时间:2013-09-21 15:23:10

标签: android xml android-layout

我反编译了.apk的输入法,我正在尝试更改屏幕上的布局。我在Nexus 10上的所需更改成功,但我的Nexus 4在logcat中遇到以下错误而崩溃。如何告诉哪个确切的.xml文件导致错误?实际上有几百个.xml文件都是相互引用的。

E/AndroidRuntime( 5344): FATAL EXCEPTION: main
E/AndroidRuntime( 5344): java.lang.RuntimeException: Binary XML file line #5: You must     supply a layout_width attribute.
E/AndroidRuntime( 5344):    at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
E/AndroidRuntime( 5344):    at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5819)
E/AndroidRuntime( 5344):    at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:5988)
E/AndroidRuntime( 5344):    at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1831)
E/AndroidRuntime( 5344):    at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1743)
E/AndroidRuntime( 5344):    at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:58)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:757)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:839)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:745)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:839)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:745)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
E/AndroidRuntime( 5344):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/AndroidRuntime( 5344):    at gp.a(SourceFile:82)
E/AndroidRuntime( 5344):    at com.google.android.apps.inputmethod.libs.framework.keyboard.KeyboardViewHelper.a(SourceFile:144)
E/AndroidRuntime( 5344):    at com.google.android.apps.inputmethod.libs.framework.keyboard.Keyboard.getBodyView(SourceFile:154)
E/AndroidRuntime( 5344):    at com.google.android.apps.inputmethod.libs.framework.keyboard.KeyboardSnapshotTaker.a(SourceFile:173)
E/AndroidRuntime( 5344):    at com.google.android.apps.inputmethod.libs.framework.keyboard.Dashboard.onKeyboardReady(SourceFile:160)
E/AndroidRuntime( 5344):    at com.google.android.apps.inputmethod.libs.framework.core.InputBundle.a(SourceFile:33)
E/AndroidRuntime( 5344):    at dO.onKeyboardDefReady(SourceFile:224)
E/AndroidRuntime( 5344):    at ed.a(SourceFile:84)
E/AndroidRuntime( 5344):    at ed.onPostExecute(SourceFile:65)
E/AndroidRuntime( 5344):    at android.os.AsyncTask.finish(AsyncTask.java:631)
E/AndroidRuntime( 5344):    at android.os.AsyncTask.access$600(AsyncTask.java:177)
E/AndroidRuntime( 5344):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
E/AndroidRuntime( 5344):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5344):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 5344):    at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime( 5344):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5344):    at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime( 5344):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime( 5344):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 5344):    at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:1)

非常确定lint应该捕获这样的错误。您可以将其用作命令行工具或从Eclipse。