0

我的安卓MK:

a.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := helloa

LOCAL_SRC_FILES := helloa.c

include $(BUILD_SHARED_LIBRARY)

b.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := hellob

LOCAL_SRC_FILES := hellob.c

LOCAL_SHARED_LIBRARIES:= helloa

include $(BUILD_STATIC_LIBRARY)

c.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := helloc

LOCAL_SRC_FILES := helloc.c

LOCAL_WHOLE_STATIC_LIBRARIES := hellob

include $(BUILD_SHARED_LIBRARY)

然后我加载共享库:

    System.loadLibrary("helloa");

    System.loadLibrary("helloc");

当应用程序调用 java 本地接口时,出现关于“libc”的错误。错误是

“致命信号 11 (sigsegv) 在 0x00000000 (code=1)”

当我将 helloa 模块更改为静态库时,并且在 hellob 模块中使用了静态库。它运作良好。

所以我怀疑应用程序在加载两个共享库时是否可以找到java本机接口的函数入口地址。

这是详细的错误:


11-07 14:55:24.387: I/DEBUG(132): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-07 14:55:24.387: I/DEBUG(132): Build fingerprint: 'Huawei/P6-U06/hwp6-u06:4.2.2/HuaweiP6-U06/C17B116SP01:user/ota-rel-keys,release-keys'

11-07 14:55:24.387: I/DEBUG(132): Revision: '0'

11-07 14:55:24.387: I/DEBUG(132): pid: 11729, tid: 11729, name: a.xianmoyaoCMCC  >>> com.ppsea.xianmoyaoCMCC <<<

11-07 14:55:24.387: I/DEBUG(132): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000

11-07 14:55:24.577: I/DEBUG(132): backtrace:

11-07 14:55:24.577: I/DEBUG(132):     #00  pc 0059c338  /mnt/asec/com.ppsea.xianmoyaoCMCC-1/lib/libxianmoyao.so

11-07 14:55:24.577: I/DEBUG(132):     #01  pc 0059c4cd  /mnt/asec/com.ppsea.xianmoyaoCMCC-1/lib/libxianmoyao.so (cocos2d::JniHelper::jstring2string(_jstring*)+24)

11-07 14:55:24.577: I/DEBUG(132): stack:

11-07 14:55:24.577: I/DEBUG(132):          be868560  400f8f44  

11-07 14:55:24.577: I/DEBUG(132):          be868564  400d6b77  /system/bin/linker

11-07 14:55:24.577: I/DEBUG(132):          be868568  00000006  

11-07 14:55:24.577: I/DEBUG(132):          be86856c  400e62d8  

11-07 14:55:24.577: I/DEBUG(132):          be868570  400e2dbb  /system/bin/linker

11-07 14:55:24.577: I/DEBUG(132):          be868574  400d6b3d  /system/bin/linker

11-07 14:55:24.577: I/DEBUG(132):          be868578  5a0be478  

11-07 14:55:24.577: I/DEBUG(132):          be86857c  400d6ec3  /system/bin/linker

11-07 14:55:24.577: I/DEBUG(132):          be868580  412eba30  [heap]

11-07 14:55:24.577: I/DEBUG(132):          be868584  41f17dd8  /dev/ashmem/dalvik-heap (deleted)

11-07 14:55:24.577: I/DEBUG(132):          be868588  00000001  
11-07 14:55:24.577: I/DEBUG(132):          be86858c  ffffffff  
11-07 14:55:24.577: I/DEBUG(132):          be868590  00000000  
11-07 14:55:24.577: I/DEBUG(132):          be868594  af17352c  
11-07 14:55:24.577: I/DEBUG(132):          be868598  df0027ad  
11-07 14:55:24.577: I/DEBUG(132):          be86859c  00000000  
11-07 14:55:24.577: I/DEBUG(132):     #00  be8685a0  410dfde0  
11-07 14:55:24.577: I/DEBUG(132):          be8685a4  be8685dc  [stack]

11-07 14:55:24.577: I/DEBUG(132):          be8685a8  41de7a08  /dev/ashmem/dalvik-heap (deleted)

11-07 14:55:24.577: I/DEBUG(132):          be8685ac  5e16e4d1  /mnt/asec/com.ppsea.xianmoyaoCMCC-1/lib/libxianmoyao.so (cocos2d::JniHelper::jstring2string(_jstring*)+28)

11-07 14:55:24.577: I/DEBUG(132):     #01  be8685b0  411e1879  
11-07 14:55:24.577: I/DEBUG(132):          be8685b4  411e1858  
11-07 14:55:24.577: I/DEBUG(132):          be8685b8  0000002f  
11-07 14:55:24.581: I/DEBUG(132):          be8685bc  5a0bee28  
11-07 14:55:24.581: I/DEBUG(132):          be8685c0  00000000  

11-07 14:55:24.581: I/DEBUG(132):          be8685c4  5d5fd590  /data/dalvik-cache/mnt@asec@com.ppsea.xianmoyaoCMCC-1@pkg.apk@classes.dex

11-07 14:55:24.581: I/DEBUG(132):          be8685c8  56f8f178  /dev/ashmem/dalvik-LinearAlloc (deleted)

11-07 14:55:24.581: I/DEBUG(132):          be8685cc  40052010  

11-07 14:55:24.581: I/DEBUG(132):          be8685d0  00000000  

11-07 14:55:24.581: I/DEBUG(132):          be8685d4  5e16d90b  /mnt/asec/com.ppsea.xianmoyaoCMCC-1/lib/libxianmoyao.so (Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetApkPath+10)

11-07 14:55:24.581: I/DEBUG(132):          be8685d8  412eba30  [heap]

11-07 14:55:24.581: I/DEBUG(132):          be8685dc  41f17ab8  /dev/ashmem/dalvik-heap (deleted)

11-07 14:55:24.581: I/DEBUG(132):          be8685e0  41de7a08  /dev/ashmem/dalvik-heap (deleted)

11-07 14:55:24.581: I/DEBUG(132):          be8685e4  407c7514  /system/lib/libdvm.so (dvmPlatformInvoke+116)

11-07 14:55:24.581: I/DEBUG(132):          be8685e8  410dfda4  

11-07 14:55:24.581: I/DEBUG(132):          be8685ec  00000001  

11-07 14:55:24.581: I/DEBUG(132): memory near r1:

11-07 14:55:24.764: I/BootReceiver(480): Copying /data/tombstones/tombstone_03 to DropBox (SYSTEM_TOMBSTONE)

11-07 14:55:24.787: I/WindowState(480): WIN DEATH: Window{42b20168 u0 com.ppsea.xianmoyaoCMCC/com.ppsea.xianmoyaoCMCC.XianMoYaoActivity}

11-07 14:55:24.787: I/ActivityManager(480): Process com.ppsea.xianmoyaoCMCC (pid 11729) has died.

错误是不能调用 Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetApkPath。

4

1 回答 1

0

为 STATIC_LIBRARY 指定 LOCAL_SHARED_LIBRARIES 无效。您必须列出模块的所有相关共享库helloc,即使它们是从使用的某个静态库继承helloc的。

于 2013-11-01T12:59:39.167 回答