gpt4 book ai didi

android - AppcompatActivity:OutMemoryException

转载 作者:行者123 更新时间:2023-11-29 14:16:46 26 4
gpt4 key购买 nike

<分区>

再次询问这个问题并提供更多细节。我们最近改用 AppCompatActivity 而不是 FragmentActivity,现在一些设备随机崩溃并出现以下错误。不知道为什么会这样。

堆栈跟踪显示它在调用 AppCompatActivity 的 super.onCreate() 时崩溃。

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 16008012 byte allocation with 4277152 free bytes and 4MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:703)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:733)
at android.graphics.drawable.BitmapDrawable.updateStateFromTypedArray(BitmapDrawable.java:779)
at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:741)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:2549)
at android.graphics.drawable.LayerDrawable.inflateLayers(LayerDrawable.java:254)
at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:164)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:2549)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:2320)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:4210)
at android.content.res.Resources.loadDrawable(Resources.java:4089)
at android.content.res.Resources.getDrawable(Resources.java:2005)
at android.content.res.Resources.getDrawable(Resources.java:1987)
at android.content.Context.getDrawable(Context.java:464)
at android.support.v4.content.ContextCompat.android.support.v4.content.ContextCompatApi21.getDrawable(SourceFile:3026)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(SourceFile:200)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(SourceFile:81)
at android.support.v7.app.AppCompatDelegateImplBase.(SourceFile:127)
at android.support.v7.app.AppCompatDelegateImplV9.(SourceFile:147)
at android.support.v7.app.AppCompatDelegateImplV11.(SourceFile:27)
at android.support.v7.app.AppCompatDelegateImplV14.(SourceFile:53)
at android.support.v7.app.AppCompatDelegateImplV23.(SourceFile:29)
at android.support.v7.app.AppCompatDelegate.create(SourceFile:203)
at android.support.v7.app.AppCompatDelegate.create(SourceFile:185)
at android.support.v7.app.AppCompatActivity.getDelegate(SourceFile:525)
at android.support.v7.app.AppCompatActivity.onCreate(SourceFile:74)
at com.dubizzle.horizontal.activities.AbstractActivity.onCreate(SourceFile:98)
at com.dubizzle.horizontal.activities.ItemPhotoViewer.onCreate(SourceFile:68)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

结构如下:ItemPhotoViewer onCreate():

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); // calls the AbstractActivity onCreate
// a bunch of other things
}

抽象 Activity onCreate():

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); // this calls AppcomPatActivity onCreate
//and crashes.
// some initializations
}

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