【问题标题】:Invalid indirect reference in decodeIndirectRefdecodeIndirectRef 中的间接引用无效
【发布时间】:2013-06-21 13:22:52
【问题描述】:

我正在尝试将 Android 设备 ID 号从 Java 返回到 C++:

目前我有以下:

在 C++ 中:

jstring Java_com_incket_OnePlayRL_OnePlayRL_uniqueCode (JNIEnv *env, jobject obj, jstring passCode)
{
    const char *ucstr;
    ucstr = env->GetStringUTFChars(passCode, 0);
    CCLog("String id is %s", ucstr);        
    env->ReleaseStringUTFChars(passCode, ucstr);
}

在 Java 方面:

public native String uniqueCode (String passCode);

static Context mContext;
private static Activity me = null;

String identifier = null;
    TelephonyManager tm = (TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm != null)
          identifier = tm.getDeviceId();
    if (identifier == null || identifier .length() == 0)
          identifier = Secure.getString(me.getContentResolver(),Secure.ANDROID_ID);
    uniqueCode (identifier);

目前,java 部分在启动时在另一个方法中被调用。这是在日志中返回的内容:

String id is e384d223aab74897
Invalid indirect reference 0xfffffe5c in decodeIndirectRef
VM aborting
Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 25515

任何帮助将不胜感激。

【问题讨论】:

    标签: android cocos2d-x


    【解决方案1】:

    您的函数应该返回一些 jstring 值:

    jstring Java_com_incket_OnePlayRL_OnePlayRL_uniqueCode(...)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-18
      • 1970-01-01
      • 2011-10-11
      • 1970-01-01
      • 2013-07-11
      • 1970-01-01
      • 2015-07-04
      相关资源
      最近更新 更多