java.lang.StackOverflow误差Android L移动preVIEW运行艺术 [英] java.lang.StackOverflow Error for Android L preview running art

查看:564
本文介绍了java.lang.StackOverflow误差Android L移动preVIEW运行艺术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直接跳转到该主题,Android L移动引入了艺术作为默认运行。我有一个示例应用程序,基本上是一个文档查看器。大多数文档查看code包括后退按钮,搜索等是用C和Android应用程序使用JNI接口。我更新了我的code,使之建立Android L和它似乎打开文档就好了。然而,当pressing后退按钮和关闭文档时,应用程序似乎崩溃和下面的回溯看出:

Jumping straight to the topic, Android L introduces a ART as default runtime. I have a Sample Application, basically a document viewer. Most of the document viewing code including back buttons, Search,etc are written in C and the Android App uses JNI interface. I updated my code to make it build for Android L and it seems to open the document just fine. However, when pressing back button and closing the document, the Application seem to crash and the following backtrace is seen:

I/DEBUG   ( 1390): Abort message: 'art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI CallIntMethodV called with pending exception 'java.lang.StackOverflowError' thrown in unknown throw location'
I/DEBUG   ( 1390): backtrace:
I/DEBUG   ( 1390):     #00 pc 000390d0  /system/lib/libc.so (tgkill+12)
I/DEBUG   ( 1390):     #01 pc 0001636d  /system/lib/libc.so (pthread_kill+64)
I/DEBUG   ( 1390):     #02 pc 00016e41  /system/lib/libc.so (raise+10)
I/DEBUG   ( 1390):     #03 pc 00013cdd  /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG   ( 1390):     #04 pc 000125ac  /system/lib/libc.so (abort+4)
I/DEBUG   ( 1390):     #05 pc 00230fe9  /system/lib/libart.so (art::Runtime::Abort()+188)
I/DEBUG   ( 1390):     #06 pc 000b9571  /system/lib/libart.so     (art::LogMessage::~LogMessage()+1360)
I/DEBUG   ( 1390):     #07 pc 000c28cd  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1124)
I/DEBUG   ( 1390):     #08 pc 000c2e11  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
I/DEBUG   ( 1390):     #09 pc 000c65e9  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1952)
I/DEBUG   ( 1390):     #10 pc 000cc8eb  /system/lib/libart.so (art::CheckJNI::CallIntMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+42)

当pressing后退按钮,当文件描述符应该关闭,CallIntMethodV被调用,最终未能在检查JNI。同样的code似乎工作的Dalvik的就好了。我不得不添加下列标志,使JNI code编译罚款Android L移动preVIEW:

Upon pressing back button, when file descriptor is supposed to close, CallIntMethodV is invoked, which ultimately fails in check JNI. Same code seems to work just fine on dalvik. I had to add the following flags to make JNI code compile fine for Android L preview:

-Wno-switch -Wno-sizeof-pointer-memaccess
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true

关键是为什么开始对艺术现在失败,但不能在Dalvik的。造成问题的原因或编译器严格导致这样的错误CallIntMethodV任何具体修改得到提升?任何指针。我会很乐意提供更多的细节,如果需要的。

The key point is why it starts failing now on art, but not on dalvik. Any specific changes in CallIntMethodV causing the problem or compiler strictness is causing such error to be raised? Any pointers. I will be happy to provide additional details if required.

更新:我暂时禁用调用文件的本地code调用到JNI关闭功能,我似乎没有现在看到任何崩溃。

UPDATE: I temporarily disabled the call to File Close function that the native code calls into JNI and I do not seem to see any crash now.

推荐答案

我希望这个问题有与引用的问题做 - 围绕保持局部引用,并用它在不同的线程或类似的东西。我不知道你是什么意思本土code调用到JNI关闭文件,但也许你正在传递的结构回从JNI的Java需要被刷新/释放(以便VM复制从c结构回虚拟机数据)。

I would expect this problem has to do with a problem with references -- keeping a local reference around and using it on a different thread or something like that. I'm not sure what you meant by "native code calls into JNI to close the file", but perhaps you are passing a structure back to Java from JNI that needs to be flushed/released (so that the VM copies the data from the c structure back to the VM).

显然,ART比Dalvik的一些严格的JNI检查。上有href=\"http://developer.android.com/guide/practices/verifying-apps-art.html\" rel=\"nofollow\">的Andr​​oid网站进一步的此页面告诉我们如何进行调试。您打开使用亚洲开发银行这样的真实设备上检查它:

Apparently the ART has a few stricter jni checks than Dalvik. There is some detail on the Android site and further this page tells us how to debug them. You turn on checking for it on a real device using adb like this:

adb shell setprop debug.checkjni 1

设置为另一个值或重启设备将关闭它。

Setting to to another value or rebooting the device will turn it off.

这篇关于java.lang.StackOverflow误差Android L移动preVIEW运行艺术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆