简体   繁体   English

Java + NDK加载本机库

[英]Java + NDK load native library

I am trying to load native library. 我正在尝试加载本机库。 I built the library using the ndk. 我使用ndk构建了库。

static {
    System.loadLibrary("NativeRegister");
}  

Every time this call end with: 每次此调用以以下结尾:

09-14 17:21:26.420: E/dalvikvm(871): VM aborting
09-14 17:21:26.420: A/libc(871): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 871 (ookbook.chaper2)

Do you know where could be the problem? 您知道问题可能在哪里吗?

usually, it is memory operation problem if the log started with "A/libc". 通常,如果日志以“ A / libc”开头,则是内存操作问题。 so you have to double check your native c code carefully, like array index, memory size and access, type casting and so on. 因此,您必须仔细检查本地c代码,例如数组索引,内存大小和访问权限,类型转换等。 there are some similar questions on stackoverflow, such as this . 关于stackoverflow也有类似的问题,例如this

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM