2
I developed an android app that works perfect, but does not run on android 5, I do not know what else to do ... Follow the log cat :
11-19 20:36:27.387 24358-24358/? I/art: Late-enabling -Xcheck:jni
11-19 20:36:27.414 24358-24368/? I/art: Debugger is no longer active
11-19 20:36:28.085 24358-24373/? I/art: Clamp target GC heap from 266MB to 256MB
11-19 20:36:28.104 24358-24358/? I/art: Clamp target GC heap from 266MB to 256MB
11-19 20:36:28.104 24358-24358/? I/art: Alloc partial concurrent mark sweep GC freed 21(848B) AllocSpace objects, 0(0B) LOS objects, 2% free, 250MB/256MB, paused 580us total 5.209ms
11-19 20:36:28.119 24358-24358/? I/art: Clamp target GC heap from 266MB to 256MB
11-19 20:36:28.119 24358-24358/? I/art: Alloc concurrent mark sweep GC freed 8(12KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 250MB/256MB, paused 831us total 15.013ms
11-19 20:36:28.119 24358-24358/? I/art: Forcing collection of SoftReferences for 22MB allocation
11-19 20:36:28.134 24358-24358/? I/art: Clamp target GC heap from 266MB to 256MB
11-19 20:36:28.134 24358-24358/? I/art: Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 2% free, 250MB/256MB, paused 982us total 14.828ms
11-19 20:36:28.135 24358-24358/? E/art: Throwing OutOfMemoryError "Failed to allocate a 24049292 byte allocation with 5599284 free bytes and 5MB until OOM"
11-19 20:36:28.136 24358-24358/? D/skia: --- allocation failed for scaled bitmap
11-19 20:36:28.136 24358-24358/? D/AndroidRuntime: Shutting down VM
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: FATAL EXCEPTION: main
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: Process: pack, PID: 24358
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 24049292 byte allocation with 5599284 free bytes and 5MB until OOM
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:973)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.content.res.Resources.loadDrawableForCookie(Resources.java:2426)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.content.res.Resources.loadDrawable(Resources.java:2333)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.view.View.<init>(View.java:3735)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.widget.TextView.<init>(TextView.java:634)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.widget.Button.<init>(Button.java:111)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.widget.Button.<init>(Button.java:107)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:64)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:60)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.internal.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:101)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:926)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:980)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:257)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at pack.HomeActivity.onCreate(HomeActivity.java:40)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5953)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:148)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5312)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
11-19 20:36:28.146 24358-24358/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
11-19 20:36:29.437 24358-24368/? I/art: Ignoring second debugger -- accepting and dropping
11-19 20:36:34.265 24358-24372/? I/art: Clamp target GC heap from 258MB to 256MB
Thank you
By error, your bitmap is exceeding the amount of memory available.
– Luiz
hmm or is the size exceeding the limit ? Ql the size max?
– Augusto Furlan
That’s it. Well, that’s a question not so easy to answer, it might depend on the memory available. In my bitmap tests, running on the emulator will make it easier to catch these OOME errors more easily than testing on a real device. I’ve had errors like this in the emulator and the actual device worked normally (which does not mean it would always work). Try looking at this link, which shows how to load large bitmaps efficiently: http://developer.android.com/intl/pt-br/training/displaying-bitmaps/load-bitmap.html
– Luiz
@Luiz worked in real, but android 5 does not work... Has some size you can use that is sure to work ?
– Augusto Furlan
@Luiz and friends, the problem is in a background image that I have, because if I withdraw it works... The image 800 x 1200 , some idea ?
– Augusto Furlan