3

我的工作是安卓框架移植。

我有很多 3rd APK 无法在我的 Android Jelly Bean 上运行。(它们都是 libmono.so 的链接器)

它们在运行时都在 libmono.so 中的 JNI_OnLoad() 函数中失败。以下是我的错误日志和分析。

//1. Android dalvik vm native.cpp ( dvmLoadNativeCode(){ ...dlopen()...})

**D/dalvikvm(2629): Added shared lib /data/data/pl.idreams.jellydefense/lib/libmono.so 0xaed3a578**

//2。Android 链接器加载 libmono.so 并返回 JNI_OnLoad 函数地址 // Android dalvik vm native.cpp ( dvmLoadNativeCode(){ ...dlsym(handle, "JNI_OnLoad")...})

**D/linker(2629): TRACE:  1252 SEARCH JNI_OnLoad in libmono.so@0xa5cf9000 0467e784 86**
**D/linker(2629): TRACE:  1252 FOUND JNI_OnLoad in libmono.so (0000a3a4) 340**

//3. Android dalvik vm native.cpp ( dvmLoadNativeCode(){ ..version = (*func)(gDvmJni.jniVm, NULL);..}) // 执行 JNI_OnLoad 函数并返回 JNI 版本,libmono dump 下面的错误信息

**E/linker(2629): ERROR: OOPS:     0 cannot map library 'libmono.so'. no vspace available.**

//4. libmono 返回 JNI 版本 = 0

**W/dalvikvm(2629): JNI_OnLoad returned bad version (0) in /data/data/pl.idreams.jellydefense/lib/libmono.so 0xaed3a578**

有人能告诉我为什么 JNI_OnLoad 在 Libmono.so 中失败了吗?

JNI_OnLoad 在 Libmono.so 中做了什么?(我会丢失一些模块或共享库吗?)

非常感谢,秦库

4

1 回答 1

1

It looks like your application is trying to allocate too much memory and Android has had enough. The cause is not necessarily your libmono.so (or the class that loads it, though these could be the culpurit), it just happens to occur during the loading of that library.

The JNI_OnLoad() function of a native library returns a JNI version to indicate it is able to proceed, or 0 if it determined it cannot proceed. It looks like a failing allocation is leading to it returning 0 to indicate it could not initialize and so cannot be used.

As to "cannot map library 'libmono.so'. no vspace available." -- this is an open source project, right? I would imagine you will have no trouble locating the JNI_OnLoad source to answer that yourself.

于 2012-09-06T11:27:48.427 回答