Crash on 5.0 but ok on other platforms

785 views Asked by At

ERR LOG:

E/art(1564): Throwing OutOfMemoryError "Failed to allocate a 14908018 byte allocation with 10763166 free bytes and 10MB until OOM"    
E/AndroidRuntime(1564): Error reporting crash    
E/AndroidRuntime(1564): java.lang.OutOfMemoryError: Failed to allocate a 14908018 byte allocation with 10763166 free bytes and 10MB until OOM    
E/AndroidRuntime(1564):     at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)    
E/AndroidRuntime(1564):     at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:125)    
E/AndroidRuntime(1564):     at java.lang.StringBuffer.append(StringBuffer.java:278)    
E/AndroidRuntime(1564):     at java.io.StringWriter.write(StringWriter.java:123)    
E/AndroidRuntime(1564):     at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:358)    
E/AndroidRuntime(1564):     at com.android.internal.util.FastPrintWriter.appendLocked(FastPrintWriter.java:303)    
E/AndroidRuntime(1564):     at com.android.internal.util.FastPrintWriter.write(FastPrintWriter.java:625)    
E/AndroidRuntime(1564):     at com.android.internal.util.FastPrintWriter.append(FastPrintWriter.java:658)    
E/AndroidRuntime(1564):     at java.io.PrintWriter.append(PrintWriter.java:691)    
E/AndroidRuntime(1564):     at java.io.PrintWriter.append(PrintWriter.java:31)    
E/AndroidRuntime(1564):     at java.lang.Throwable.printStackTrace(Throwable.java:324)    
E/AndroidRuntime(1564):     at java.lang.Throwable.printStackTrace(Throwable.java:300)    
E/AndroidRuntime(1564):     at android.util.Log.getStackTraceString(Log.java:335)    
E/AndroidRuntime(1564):     at com.android.internal.os.RuntimeInit.Clog_e(RuntimeInit.java:59)    
E/AndroidRuntime(1564):     at com.android.internal.os.RuntimeInit.access$200(RuntimeInit.java:43)    
E/AndroidRuntime(1564):     at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:85)    
E/AndroidRuntime(1564):     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)    
E/AndroidRuntime(1564):     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)    
E/NMGDevice(1619): Exception:Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference

I can not find anymore information about this question. only i know when i load image will crash. my app is ok on other version, but on 5.0. i guess is ART and Dalvik, or something worng about "NMGDevice" class?

Why is the program crashing on Android 5?

1

There are 1 answers

1
jww On

From this, you ran out of memory:

 E/AndroidRuntime(1564): java.lang.OutOfMemoryError: Failed to allocate a 14908018 byte allocation with 10763166 free bytes and 10MB until OOM 

Then, you tried to access the null reference you got back:

E/NMGDevice(1619): Exception:Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference

Validate your return values. Stop swallowing exceptions.