gpt4 book ai didi

android - 增加 minSdkVersion 会导致内存不足错误

转载 作者:行者123 更新时间:2023-11-30 04:42:11 26 4
gpt4 key购买 nike

我在开发应用时将 minSdkVersion 设置为 3,targetSdkVersion 设置为 8。

我的应用程序已发布,并且可以在从 Android 1.5 到 3.0 的所有设备上运行虽然它可以在任何早于 2.0 的设备上运行,但它总是参差不齐,有些会,有些不会 p>

它在我的 Incredible 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!

最佳答案

将您的 minSdkVersion 设置为 API 级别 7,API 级别 5 和 6 不再可用,因为 2.0 已被完全淘汰。 Android SDK 管理器不再将这些 API 作为可用包提供,因为它们已被标记为已过时。我刚刚在新系统上进行了新安装,发现 API 不可用。

关于android - 增加 minSdkVersion 会导致内存不足错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5783187/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com