Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17085

[Android] Fatal Error signal 11 (SIGSEGV), 0000002c after upgrading to cocos2d-x-2.2.6

$
0
0

@antonyPeter wrote:

Hi

After upgrading the cocos2dx from version 2.1.0 to 2.2.6, Android App crashes with Fatal Error signal 11 (SIGSEGV), 0000002c while launching the app but iOS app works fine.

Crash dump

    ********** Crash dump: **********
Build fingerprint: ‘xxxxxxxxx’
pid: 18833, tid: 18997, name: Thread-1305  >>> com.xxx.xxx <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000002c
Stack frame #00  pc 0004c56c  /system/lib/libdvm.so
Stack frame #01  pc 0036e3a1  /data/app-lib/com.xxx.xxx-1/libcocos2dcpp.so (cocos2d::JniHelper::getStaticMethodInfo(cocos2d::JniMethodInfo_&, char const*, char const*, char const*)+52)
Stack frame #02  pc 0036ddfd  /data/app-lib/com.xxx.xxx-1/libcocos2dcpp.so (getStringForKeyJNI(char const*, char const*)+36)

Android Logcat

07-22 10:32:54.416 32602-614/com.xxx.xxx D/JniHelper: Failed to find class of org/cocos2dx/lib/Cocos2dxHelper
07-22 10:32:54.416 32602-614/com.xxx.xxx  A/libc: Fatal signal 11 (SIGSEGV) at 0x0000002c (code=1), thread 614 (Thread-1707)

Java_org_cocos2dx_lib_Cocos2dxHelper.cpp

std::string getStringForKeyJNI(const char* pKey, const char* defaultValue)
{
    JniMethodInfo t;
    std::string ret("");

    if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getStringForKey", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;")) {
        jstring stringArg1 = t.env->NewStringUTF(pKey);
        jstring stringArg2 = t.env->NewStringUTF(defaultValue);
        jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, stringArg1, stringArg2);
        ret = JniHelper::jstring2string(str);

        t.env->DeleteLocalRef(t.classID);
        t.env->DeleteLocalRef(stringArg1);
        t.env->DeleteLocalRef(stringArg2);
        t.env->DeleteLocalRef(str);

        return ret;
    }

    return defaultValue;
}

JniHelper.cpp

static bool getStaticMethodInfo_(cocos2d::JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
{

    jmethodID methodID = 0;
    JNIEnv *pEnv = 0;
    bool bRet = false;

    do 
    {
        if (! getEnv(&pEnv))
        {
            break;
        }

        jclass classID = getClassID_(className, pEnv);
        methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
        if (! methodID)
        {
            LOGD("Failed to find static method id of %s", methodName);
            break;
        }

        methodinfo.classID = classID;
        methodinfo.env = pEnv;
        methodinfo.methodID = methodID;
        bRet = true;
    } while (0);


    return bRet;
}

I found that the program crash is caused by methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode); in getStaticMethodInfo_

I have been dealing with this issue for a week. Please kindly help.
Many Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17085

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>