在我的人名设备上我得到内存不足导致的错误但是当我在另一台设备上尝试相同的程序时它似乎工作得很好
05-14 21:52:54.625: I/dalvikvm(3561): Wrote stack traces to '/data/anr/traces.txt'
05-14 21:52:55.135: I/dalvikvm(3561): threadid=3: reacting to signal 3
05-14 21:52:55.135: I/dalvikvm(3561): Wrote stack traces to '/data/anr/traces.txt'
05-14 21:52:56.785: D/dalvikvm(3561): GC_FOR_ALLOC freed 10K, 3% free 9663K/9863K, paused 13ms
05-14 21:52:56.785: I/dalvikvm-heap(3561): Grow heap (frag case) to 10.158MB for 633616-byte allocation
05-14 21:52:56.820: D/dalvikvm(3561): GC_CONCURRENT freed 3K, 3% free 10278K/10503K, paused 1ms+1ms
05-14 21:52:56.845: D/dalvikvm(3561): GC_FOR_ALLOC freed <1K, 3% free 10280K/10503K, paused 10ms
05-14 21:52:56.850: I/dalvikvm-heap(3561): Grow heap (frag case) to 10.759MB for 633616-byte allocation
05-14 21:52:56.885: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 3% free 10898K/11143K, paused 2ms+2ms
05-14 21:52:56.910: D/dalvikvm(3561): GC_FOR_ALLOC freed <1K, 3% free 10899K/11143K, paused 13ms
05-14 21:52:56.910: I/dalvikvm-heap(3561): Grow heap (frag case) to 11.365MB for 633616-byte allocation
05-14 21:52:56.935: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 3% free 11518K/11783K, paused 1ms+1ms
05-14 21:53:04.005: D/dalvikvm(3561): GC_FOR_ALLOC freed 13K, 2% free 11708K/11847K, paused 24ms
05-14 21:53:04.055: D/dalvikvm(3561): GC_CONCURRENT freed 419K, 5% free 12089K/12679K, paused 1ms+2ms
05-14 21:53:04.080: D/dalvikvm(3561): GC_FOR_ALLOC freed 0K, 5% free 12089K/12679K, paused 9ms
05-14 21:53:04.080: I/dalvikvm-heap(3561): Grow heap (frag case) to 13.680MB for 1843216-byte allocation
05-14 21:53:04.105: D/dalvikvm(3561): GC_CONCURRENT freed 0K, 5% free 13889K/14535K, paused 1ms+1ms
05-14 21:53:04.150: D/dalvikvm(3561): GC_FOR_ALLOC freed 800K, 10% free 13891K/15367K, paused 9ms
05-14 21:53:04.155: I/dalvikvm-heap(3561): Grow heap (frag case) to 15.440MB for 1843216-byte allocation
05-14 21:53:04.175: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 9% free 15691K/17223K, paused 1ms+2ms
05-14 21:53:05.370: E/AndroidRuntime(3561): at dalvik.system.NativeStart.main(Native Method)
05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: android.view.InflateException: Binary XML file line #158: Error inflating class <unknown>
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
05-14 21:53:05.370: E/AndroidRuntime(3561): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-14 21:53:05.370: E/AndroidRuntime(3561): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Activity.setContentView(Activity.java:1835)
05-14 21:53:05.370: E/AndroidRuntime(3561): at pilestudios.dirtyyou.singleplay.onCreate(singleplay.java:23)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Activity.performCreate(Activity.java:4465)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-14 21:53:05.370: E/AndroidRuntime(3561): ... 11 more
05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: java.lang.reflect.InvocationTargetException
05-14 21:53:05.370: E/AndroidRuntime(3561): at java.lang.reflect.Constructor.constructNative(Native Method)
05-14 21:53:05.370: E/AndroidRuntime(3561): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
05-14 21:53:05.370: E/AndroidRuntime(3561): ... 26 more
05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: java.lang.OutOfMemoryError
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.nativeCreate(Native Method)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.content.res.Resources.loadDrawable(Resources.java:1966)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.widget.ImageView.<init>(ImageView.java:119)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.widget.ImageView.<init>(ImageView.java:109)
答案 0 :(得分:2)
不同的设备具有不同的堆大小。
您可以尝试缩小图片以查看它是否有帮助。