[英]Why do i get an Inflate exception on the emulator but not on my Droid?
My code runs fine on my Motorola Droid but when i run it on the emulator i get this stack trace:我的代码在我的摩托罗拉 Droid 上运行良好,但是当我在模拟器上运行它时,我得到了这个堆栈跟踪:
07-05 14:29:23.035: ERROR/AndroidRuntime(237): Uncaught handler: thread main exiting due to uncaught exception
07-05 14:29:23.075: ERROR/AndroidRuntime(237): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thinknao.wordlands/com.thinknao.wordlands.OptionsPage}: android.view.InflateException: Binary XML file line #16: Error inflating class java.lang.reflect.Constructor
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
07-05 14:29:23.075: ERROR/AndroidRuntime(237): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class java.lang.reflect.Constructor
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at android.view.LayoutInflater.createView(LayoutInflater.java:512)
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
07-05 14:29:23.075: ERROR/AndroidRuntime(237): Caused by: java.lang.reflect.InvocationTargetException
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at android.widget.Button.<init>(Button.java:65)
07-05 14:29:23.075: ERROR/AndroidRuntime(237): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
07-05 14:29:23.075: ERROR/AndroidRuntime(237): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
It's difficult to be exact without seeing your code and layout, but you are running out of memory.没有看到您的代码和布局就很难准确,但是您的 memory 已经用完了。 It looks to be concerned with the loading of a bitmap object, one that is referenced on line 16 of your layout file.
它看起来与 bitmap object 的加载有关,这是在您的布局文件的第 16 行引用的。
I would suggest that either you are using a very large image file;我建议您使用非常大的图像文件; you are using lots of images;
您正在使用大量图像; or a combination of the two.
或两者的组合。
The reason that it runs on the Droid but not on the emulator is, most likely, that the emulator has been configured with less memory than the phone.它在 Droid 上运行但不在模拟器上运行的原因很可能是模拟器配置的 memory 比手机少。 You can change your emulator settings in the AVD manager.
您可以在 AVD 管理器中更改您的模拟器设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.