java.lang.OutOfMemoryError-无法打开第二个活动

时间:2018-11-05 15:57:32

标签: android android-studio

因此,我遇到了java.lang.OutOfMemoryError错误,无法打开我的应用程序。我向AndroidManifest.xml中添加了android:hardwareAccelerated="false" and android:largeHeap="true",但是现在单击按钮时无法打开下一个活动。该应用程序将崩溃,并显示以下错误。第二个活动有一个图像,2个文本视图和5个按钮。

11-05 04:33:17.420 15163-15163/? E/Zygote: v2
11-05 04:33:17.430 15163-15163/? E/Zygote: accessInfo : 0
11-05 04:33:22.670 15163- 
15163/dev.ddc.josephsiccita.diamonddancechallenge E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dev.ddc.josephsiccita.diamonddancechallenge, PID: 15163
    java.lang.OutOfMemoryError: Failed to allocate a 568189452 byte allocation with 16765568 free bytes and 357MB until OOM
        at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
        at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856)
        at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675)
        at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:2228)
        at android.content.res.Resources.loadDrawableForCookie(Resources.java:4211)
        at android.content.res.Resources.loadDrawable(Resources.java:4085)
        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.getDrawable(ContextCompat.java:463)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:203)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
        at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102)
        at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:59)
        at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
        at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
        at android.support.v7.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:182)
        at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
        at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
        at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:758)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at dev.ddc.josephsiccita.diamonddancechallenge.Main2Activity.onCreate(Main2Activity.java:20)
        at android.app.Activity.performCreate(Activity.java:6876)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
        at android.app.ActivityThread.access$1100(ActivityThread.java:221)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:158)
        at android.app.ActivityThread.main(ActivityThread.java:7224)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

0 个答案:

没有答案