我開發我的應用程序的minSdkVersion設置爲3,targetSdkVersion設置爲8增加的minSdkVersion導致內存不足的錯誤
我的應用程序發佈,並在一切運行於Android 1.5至3.0 雖然它可以運行在設備與2.0以上的東西總是參差不齊,一些它會和一些它不會
它適用於我的令人難以置信的,Android 2.2完美。運行時使用5-8mb內存。
但是我決定將其分成兩個不同的應用程序,一個用於Android 1.5和1.6兼容性,另一個用於爲平板電腦優化的高質量圖像。
我改變的唯一線路是將minSdkVersion從3設置爲5,突然它不會在任何手機或模擬器上運行? 現在在我的Incredible中,它使用7mb來顯示菜單背景,並且每次載入另一個圖像時都會給我一個內存不足的錯誤。
任何想法?由於
04-25 17:19:45.476: ERROR/dalvikvm-heap(20145): 7094850-byte external allocation too large for this process.
04-25 17:19:45.476: ERROR/dalvikvm(20145): Out of memory: Heap Size=4871KB, Allocated=2517KB, Bitmap Size=19170KB
04-25 17:19:45.476: ERROR/GraphicsJNI(20145): VM won't let us allocate 7094850 bytes
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): FATAL EXCEPTION: main
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): java.lang.RuntimeException: Unable to resume activity {com.ht/com.ht.Garage}: android.view.InflateException: Binary XML file line #10: Error inflating class com.ht.Panel
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3347)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3362)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread.access$2300(ActivityThread.java:135)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.os.Looper.loop(Looper.java:144)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread.main(ActivityThread.java:4937)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at java.lang.reflect.Method.invoke(Method.java:521)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at dalvik.system.NativeStart.main(Native Method)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.ht.Panel
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.Activity.setContentView(Activity.java:1654)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at com.ht.Garage.onResume(Garage.java:165)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1255)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.Activity.performResume(Activity.java:3864)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3337)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): ... 12 more
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): Caused by: java.lang.reflect.InvocationTargetException
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at com.ht.Panel.<init>(Panel.java:107)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at java.lang.reflect.Constructor.constructNative(Native Method)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): ... 23 more
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.graphics.Bitmap.nativeCreate(Native Method)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): at android.graphics.Bitmap.createBitmap(Bitmap.java:574)
04-25 17:19:45.506: ERROR/AndroidRuntime(20145): ... 27 more
04-25 17:19:48.066: ERROR/ActivityManager(97): fail to set top app changed!
檢查您的錯誤信息,並在此發佈。 – Wroclai 2011-04-25 21:00:22
如果您將其更改回3,它是否有效? – zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz 2011-04-25 21:02:41
是的,如果我把它改回到3,它會再次運作。 – Allen 2011-04-25 21:15:21