0

我做了一个基于电话系统的项目。它适用于任何三星 android 设备、HTC 和摩托罗拉。但问题是,当我尝试在索尼爱立信 Android 设备中运行它时,即使我打开应用程序,它也会强制关闭。

(1st time i open the application it works fine,2nd time open,getting force close....3rd time open, 4th time force close... repeated....)

这是我的日志猫

08-29 16:53:03.346: E/AndroidRuntime(5812): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.excel.extel/com.excel.extel.ExtelMain}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.excel.extel/com.excel.extel.DialerTab}: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.access$1500(ActivityThread.java:121)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.os.Looper.loop(Looper.java:123)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.main(ActivityThread.java:3701)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Method.invokeNative(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Method.invoke(Method.java:507)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at dalvik.system.NativeStart.main(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.excel.extel/com.excel.extel.DialerTab}: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.startActivityNow(ActivityThread.java:1499)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:676)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.TabHost.setCurrentTab(TabHost.java:348)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.TabHost.addTab(TabHost.java:238)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.excel.extel.ExtelMain.onCreate(ExtelMain.java:67)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
08-29 16:53:03.346: E/AndroidRuntime(5812):  ... 11 more
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown>
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.Activity.setContentView(Activity.java:1657)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at com.excel.extel.DialerTab.onCreate(DialerTab.java:139)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
08-29 16:53:03.346: E/AndroidRuntime(5812):  ... 20 more
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: java.lang.reflect.InvocationTargetException
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Constructor.constructNative(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-29 16:53:03.346: E/AndroidRuntime(5812):  ... 32 more
08-29 16:53:03.346: E/AndroidRuntime(5812): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.content.res.Resources.loadDrawable(Resources.java:1713)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.view.View.<init>(View.java:1969)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.ImageView.<init>(ImageView.java:116)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.ImageButton.<init>(ImageButton.java:85)
08-29 16:53:03.346: E/AndroidRuntime(5812):  at android.widget.ImageBu

有谁告诉我什么问题?是我的错还是套装的问题?

4

1 回答 1

1
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

这意味着设备内存不足并被强制关闭。

现在,既然您说应用程序是第一次运行但以后不再运行,我相信您并没有释放资源。位图有时会占用大量空间,如果您将它们保存在内存中,如果设备出现 OOM,我不会感到惊讶。不同的设备具有不同的内存规格,这就是它在某些设备上运行但在其他设备上不运行的原因。

因此,我的建议是清除位图和您用于临时目的的其他存储。

如果这仍然不能解决您的问题,请将代码发布到您处理图像的位置,我们将尝试查看是否有更高效的内存方式来处理您正在做的事情。

祝你好运!

于 2012-08-29T22:39:21.747 回答