gpt4 book ai didi

android - 使用此处 sdk 时出现内存不足错误

转载 作者:搜寻专家 更新时间:2023-11-01 09:41:48 24 4
gpt4 key购买 nike

我正在尝试使用 HERE Maps android SDK 并在运行 API 19(KitKat) 的设备上进行测试。但是我在启动时出现内存不足错误。它以错误 E/dalvikvm-heap: Out of memory on a 262160-byte allocation. 并通过抛出异常而崩溃:

E/AndroidRuntime: FATAL EXCEPTION: main                                                
java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
at android.content.res.Resources.loadDrawable(Resources.java:2166)
at android.content.res.Resources.getDrawable(Resources.java:710)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:202)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:192)
at android.support.v7.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:421)
at android.support.v7.view.menu.ActionMenuItemView.initialize(ActionMenuItemView.java:114)
at android.support.v7.widget.ActionMenuPresenter.bindItemView(ActionMenuPresenter.java:206)
at android.support.v7.view.menu.BaseMenuPresenter.getItemView(BaseMenuPresenter.java:182)
at android.support.v7.widget.ActionMenuPresenter.getItemView(ActionMenuPresenter.java:192)
at android.support.v7.widget.ActionMenuPresenter.flagActionItems(ActionMenuPresenter.java:480)
at android.support.v7.view.menu.MenuBuilder.flagActionItems(MenuBuilder.java:1138)
at android.support.v7.view.menu.BaseMenuPresenter.updateMenuView(BaseMenuPresenter.java:91)
at android.support.v7.widget.ActionMenuPresenter.updateMenuView(ActionMenuPresenter.java:229)
at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate(MenuBuilder.java:284)
at android.support.v7.view.menu.MenuBuilder.onItemsChanged(MenuBuilder.java:1030)
at android.support.v7.view.menu.MenuBuilder.startDispatchingItemsChanged(MenuBuilder.java:1053)
at android.support.v7.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:460)
at android.support.v7.app.ToolbarActionBar$1.run(ToolbarActionBar.java:61)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)

这似乎是一个位图问题。但是我没有加载任何位图。现在新的异常是:java.lang.OutOfMemoryError
在 java.io.SerializationHandleMap.resizeArrays(SerializationHandleMap.java:48)
在 java.io.SerializationHandleMap.rehash(SerializationHandleMap.java:120)
在 java.io.SerializationHandleMap.put(SerializationHandleMap.java:104)
在 java.io.ObjectOutputStream.registerObjectWritten(ObjectOutputStream.java:493)
在 java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1353)
在 java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1649)
在 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1495)
在 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1459)
在 java.util.Hashtable.writeObject(Hashtable.java:1079)
在 java.lang.reflect.Method.invokeNative( native 方法)
在 java.lang.reflect.Method.invoke(Method.java:515)
在 java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1031)
在 java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1382)
在 java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1649)
在 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1495)
在 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1459)
在 com.here.android.mpa.internal.cd.c(ObjectSerializer.java:45)
在 com.here.android.mpa.internal.cd.a(ObjectSerializer.java:22)
在 com.here.android.mpa.internal.cd$1.run(ObjectSerializer.java:97)
在 java.util.Timer$TimerImpl.run(Timer.java:284)

最佳答案

application 标签下的 AndroidManifest 文件中使用这个

android:largeHeap="true"

关于android - 使用此处 sdk 时出现内存不足错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39566187/

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