由于操作栏,应用程序在较小的设备上崩溃

时间:2015-03-31 11:34:39

标签: android

当我在小型设备上运行我的应用程序时,我的应用程序崩溃了......我正在使用操作栏,我正在使用appcompat_v7_2 lib ...它在所有设备中工作正常,除了较小的320x240 ... 我收到了这个错误,我搜索了很多,但没有任何帮助我...

03-31 06:42:32.228: E/AndroidRuntime(1000): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shopping.online/com.shopping.online.MainActivity}: java.lang.RuntimeException: Binary XML file line #149: You must supply a layout_width attribute.
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.os.Looper.loop(Looper.java:137)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.ActivityThread.main(ActivityThread.java:5103)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at java.lang.reflect.Method.invokeNative(Native Method)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at java.lang.reflect.Method.invoke(Method.java:525)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at dalvik.system.NativeStart.main(Native Method)
03-31 06:42:32.228: E/AndroidRuntime(1000): Caused by: java.lang.RuntimeException: Binary XML file line #149: You must supply a layout_width attribute.
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5823)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:5992)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.widget.RelativeLayout$LayoutParams.<init>(RelativeLayout.java:1246)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:1083)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:84)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:757)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.Activity.setContentView(Activity.java:1895)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at com.shopping.online.MainActivity.onCreate(MainActivity.java:94)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.Activity.performCreate(Activity.java:5133)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-31 06:42:32.228: E/AndroidRuntime(1000):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
03-31 06:42:32.228: E/AndroidRuntime(1000):     ... 11 more

1 个答案:

答案 0 :(得分:0)

这只是一个疯狂的猜测,但我遇到了一个类似的问题,这个问题在Android 4.1或4.2的某些三星设备中是一个错误,其内部有一个名称与支持中的一个相同的类图书馆。

我知道这听起来很奇怪,但是你的异常让我想起了我从那里得到的那个。

您确定它与显示器尺寸有关,还是您的小型设备是三星设备?

修改

三星错误和修正的描述可以是found here。但是这种表现看起来很不一样,所以我比以前更不确定。