缓冲区溢出-Android中没有可用空间崩溃

缓冲区溢出-Android中没有可用空间崩溃,android,crash,buffer-overflow,Android,Crash,Buffer Overflow,所以,我经常遇到缓冲区溢出崩溃(393238) 我刚刚修复的一个例子是,当我运行Log.d(“test”,null)时,我得到了崩溃 如果我删除这行代码,就不会发生崩溃 据我所知,我的代码中的每一个bug,无论是边界数组、不正确的类型、空异常等等,都会导致缓冲区溢出崩溃 我不知道为什么会这样。为什么Android不能优雅地处理和返回异常消息,而不是一直用缓冲区溢出消息使程序崩溃 此外,我还尝试通过usb调试、Nexus emulator等在自己的手机上运行,但这种情况仍然存在 以下是确切的信息:

所以,我经常遇到缓冲区溢出崩溃(393238)

我刚刚修复的一个例子是,当我运行
Log.d(“test”,null)
时,我得到了崩溃

如果我删除这行代码,就不会发生崩溃

据我所知,我的代码中的每一个bug,无论是
边界数组
、不正确的类型、空异常等等,都会导致缓冲区溢出崩溃

我不知道为什么会这样。为什么Android不能优雅地处理和返回异常消息,而不是一直用缓冲区溢出消息使程序崩溃

此外,我还尝试通过usb调试、Nexus emulator等在自己的手机上运行,但这种情况仍然存在

以下是确切的信息:

W/ErrorProcessor: onFatalError, processing error from engine(4)
com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
    at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
    at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)
    at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
    at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
    at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
    at java.io.InputStream.read(InputStream.java:101)
    at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
    at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
    at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
    at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
    at java.lang.Thread.run(Thread.java:761) 
    at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85) 

我也有同样的想法。我的应用程序在安卓工作室的主计算机上运行良好,既可以在真正的安卓平板电脑上运行,也可以在平板电脑模拟器上运行。当我在我的笔记本电脑上做了完全相同的事情时,我得到了这个崩溃,无论是对于真实设备还是模拟器


我最终通过删除项目构建目录,并执行工具->AVD管理器->操作擦除数据来“修复”。然后我重建/运行了这个项目,它成功了。看看图…

通过
Log.d(“test”,null)
你期望得到什么?它没有任何意义,它将抛出
java.lang.NullPointerException
是的,它应该抛出空指针异常,但我得到了一个缓冲区溢出崩溃。我的问题是为什么?尝试
使缓存无效/重新启动…
不幸没有修复它