在5.0上崩溃但在其他平台上没问题

时间:2014-12-08 06:47:28

标签: android android-runtime

ERR日志:

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

我找不到关于这个问题的更多信息。只有我知道当我加载图像会崩溃。 我的应用程序在其他版本上没问题,但在5.0上。我猜是ART和Dalvik,或者是关于" NMGDevice"类?

为什么程序会在Android 5上崩溃?

1 个答案:

答案 0 :(得分:1)

由此,你的内存不足了:

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

然后,您尝试访问了您获得的null引用:

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

验证您的返回值。不要吞咽异常。