简体   繁体   English

为什么我在模拟器上出现 Inflate 异常,但在我的 Droid 上却没有?

[英]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.

相关问题 为什么我会收到Layout inflate异常? - why do i get a Layout inflate exception? 在机器人中我怎么有一个异常不仅被抓住 - in droid how do i have an exception get not only caught 我的函数是异步的,为什么会出现 NetworkOnMainThread 异常? - My function is asynchronous, why do I get a NetworkOnMainThread Exception? 使用gridlayout获取Inflate Exception - get Inflate Exception with gridlayout Android:为什么在我为资源布局文件充气时我的用户界面没有被绘制? - Android: Why my user Interface does not get drawn when I Inflate the resource layout file? 我收到膨胀异常,不知道为什么? - I'm getting Inflate Exception and don't know why? 我的代码正确,我的Droid模拟器运行,但该应用程序无法运行(Eclipse) - My code is correct, my Droid emulator runs, but the App will not run (Eclipse) 为什么我不能在Android中为片段充气? - Why can't I inflate my Fragments in Android? 为什么我得到一个模拟器-5554断开连接的消息 - Why do I get a emulator-5554 disconnected message 我什么时候必须膨胀我的自定义视图的布局? - When do I have to inflate the layout of my custom view?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM