zhangjianhd/NoviceGuide

雷电模拟器上测试崩溃

Closed this issue · 1 comments

多个引导页的情况下,引导页是一个图片布局。
代码跟文档一致,只是换了一下布局文件跟id。

Process: com.qi.trafficproxy, PID: 11066 java.lang.OutOfMemoryError: Failed to allocate a 74649612 byte allocation with 16777216 free bytes and 47MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:620) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:455) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1155) at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:720) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571) at android.content.res.Resources.loadDrawable(Resources.java:858) at android.content.res.TypedArray.getDrawable(TypedArray.java:928) at android.view.View.<init>(View.java:4202) at android.view.ViewGroup.<init>(ViewGroup.java:581) at android.widget.RelativeLayout.<init>(RelativeLayout.java:248) at android.widget.RelativeLayout.<init>(RelativeLayout.java:244) at android.widget.RelativeLayout.<init>(RelativeLayout.java:240) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at android.view.LayoutInflater.createView(LayoutInflater.java:645) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:426) at com.zj.lib.noviceguide.NoviceGuide.show(NoviceGuide.java:115) at com.zj.lib.noviceguide.NoviceGuideSet$1.onDismiss(NoviceGuideSet.java:25) at com.zj.lib.noviceguide.NoviceGuide$1.onClick(NoviceGuide.java:122) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6145) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:892) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)

你这个是切图太大了导致的。
1.切图不要用太大
2.切图要根据需要放到对应的*dpi-drawable文件夹下面,把大尺寸的切图放到drawable文件夹下面,加载时也会导致内存超出