应用程序在2.2中崩溃但在较高版本中没有崩溃

时间:2014-07-17 07:23:48

标签: android

我正在使用appcompat_v7用于操作栏兼容性& android-support-v4.jar用于片段兼容性,但我的应用程序在2.2中崩溃。

logcat的

07-17 12:43:27.785: I/dalvikvm(327): Could not find method android.content.pm.PackageManager.getActivityLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
07-17 12:43:27.785: W/dalvikvm(327): VFY: unable to resolve virtual method 319: Landroid/content/pm/PackageManager;.getActivityLogo (Landroid/content/ComponentName;)Landroid/graphics/drawable/Drawable;
07-17 12:43:27.795: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x008b
07-17 12:43:27.795: I/dalvikvm(327): Could not find method android.content.pm.ApplicationInfo.loadLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
07-17 12:43:27.795: W/dalvikvm(327): VFY: unable to resolve virtual method 315: Landroid/content/pm/ApplicationInfo;.loadLogo (Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
07-17 12:43:27.795: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x0099
07-17 12:43:27.805: D/dalvikvm(327): VFY: dead code 0x008e-0092 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
07-17 12:43:27.805: D/dalvikvm(327): VFY: dead code 0x009c-00a0 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
07-17 12:43:28.055: I/dalvikvm(327): Could not find method com.example.indianconstitution.MainActivity.invalidateOptionsMenu, referenced from method com.example.indianconstitution.MainActivity$1.onDrawerClosed
07-17 12:43:28.055: W/dalvikvm(327): VFY: unable to resolve virtual method 8698: Lcom/example/indianconstitution/MainActivity;.invalidateOptionsMenu ()V
07-17 12:43:28.055: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x002d
07-17 12:43:28.055: D/dalvikvm(327): VFY: dead code 0x0030-0030 in Lcom/example/indianconstitution/MainActivity$1;.onDrawerClosed (Landroid/view/View;)V
07-17 12:43:28.065: I/dalvikvm(327): Could not find method com.example.indianconstitution.MainActivity.invalidateOptionsMenu, referenced from method com.example.indianconstitution.MainActivity$1.onDrawerOpened
07-17 12:43:28.065: W/dalvikvm(327): VFY: unable to resolve virtual method 8698: Lcom/example/indianconstitution/MainActivity;.invalidateOptionsMenu ()V
07-17 12:43:28.065: D/dalvikvm(327): VFY: replacing opcode 0x6e at 0x002d
07-17 12:43:28.065: D/dalvikvm(327): VFY: dead code 0x0030-0030 in Lcom/example/indianconstitution/MainActivity$1;.onDrawerOpened (Landroid/view/View;)V
07-17 12:43:28.215: D/AndroidRuntime(327): Shutting down VM
07-17 12:43:28.225: W/dalvikvm(327): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-17 12:43:28.254: E/AndroidRuntime(327): FATAL EXCEPTION: main
07-17 12:43:28.254: E/AndroidRuntime(327): android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.createView(LayoutInflater.java:513)
07-17 12:43:28.254: E/AndroidRuntime(327):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-17 12:43:28.254: E/AndroidRuntime(327):  at com.example.indianconstitution.NavDrawerListAdapter.getView(NavDrawerListAdapter.java:44)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.AbsListView.obtainView(AbsListView.java:1315)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.ListView.makeAndAddView(ListView.java:1727)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.ListView.fillDown(ListView.java:652)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.ListView.fillFromTop(ListView.java:709)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.ListView.layoutChildren(ListView.java:1580)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.AbsListView.onLayout(AbsListView.java:1147)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:767)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.FrameLayout.onLayout(FrameLayout.java:333) 
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.layout(View.java:7035)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.os.Looper.loop(Looper.java:123)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-17 12:43:28.254: E/AndroidRuntime(327):  at java.lang.reflect.Method.invokeNative(Native Method)
07-17 12:43:28.254: E/AndroidRuntime(327):  at java.lang.reflect.Method.invoke(Method.java:521)
07-17 12:43:28.254: E/AndroidRuntime(327):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-17 12:43:28.254: E/AndroidRuntime(327):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-17 12:43:28.254: E/AndroidRuntime(327):  at dalvik.system.NativeStart.main(Native Method)
07-17 12:43:28.254: E/AndroidRuntime(327): Caused by: java.lang.reflect.InvocationTargetException
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.TextView.<init>(TextView.java:321)
07-17 12:43:28.254: E/AndroidRuntime(327):  at java.lang.reflect.Constructor.constructNative(Native Method)
07-17 12:43:28.254: E/AndroidRuntime(327):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.LayoutInflater.createView(LayoutInflater.java:500)
07-17 12:43:28.254: E/AndroidRuntime(327):  ... 36 more
07-17 12:43:28.254: E/AndroidRuntime(327): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.view.View.<init>(View.java:2036)
07-17 12:43:28.254: E/AndroidRuntime(327):  at android.widget.TextView.<init>(TextView.java:327)
07-17 12:43:28.254: E/AndroidRuntime(327):  ... 40 more
07-17 12:43:28.355: D/dalvikvm(327): GC_FOR_MALLOC freed 3423 objects / 301120 bytes in 90ms

任何想法为什么我会收到此错误?

如何解决?

提前致谢

1 个答案:

答案 0 :(得分:0)

您正在调用Android 2.2中不存在的方法(但在更高版本中确实存在)。使用Lint工具检查您的代码并进行修复。