在我的条形码扫描仪应用程序中,使用zbar lib扫描条形码。它将运行时异常作为OutOfMemoryError。
任何人都可以帮忙解决这个问题。
logcat的:
2-16 13:06:01.635: W/linker(15501): libzbarjni.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
12-16 13:06:06.483: E/art(15501): Throwing OutOfMemoryError "Failed to allocate a 53654136 byte allocation with 16777216 free bytes and 47MB until OOM"
12-16 13:06:06.483: E/AndroidRuntime(15501): Error reporting crash
12-16 13:06:06.483: E/AndroidRuntime(15501): java.lang.OutOfMemoryError: Failed to allocate a 53654136 byte allocation with 16777216 free bytes and 47MB until OOM
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:125)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.StringBuffer.append(StringBuffer.java:278)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.io.StringWriter.write(StringWriter.java:123)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:358)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.util.FastPrintWriter.appendLocked(FastPrintWriter.java:303)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.util.FastPrintWriter.write(FastPrintWriter.java:625)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.util.FastPrintWriter.append(FastPrintWriter.java:658)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.io.PrintWriter.append(PrintWriter.java:691)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.io.PrintWriter.append(PrintWriter.java:31)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.Throwable.printStackTrace(Throwable.java:324)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.Throwable.printStackTrace(Throwable.java:300)
12-16 13:06:06.483: E/AndroidRuntime(15501): at android.util.Log.getStackTraceString(Log.java:335)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.os.RuntimeInit.Clog_e(RuntimeInit.java:59)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.os.RuntimeInit.access$200(RuntimeInit.java:43)
12-16 13:06:06.483: E/AndroidRuntime(15501): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:85)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
12-16 13:06:06.483: E/AndroidRuntime(15501): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
答案 0 :(得分:0)
由于内存问题,我在某些设备上收到此错误。我通过在工作区中导入zbar整个lib代码并使用zbar lib app作为lib来自工作区而不是在我自己的应用程序中添加/保留lib(.jar)来解决它。