gpt4 book ai didi

android - decodeIndirectRef 中的间接引用无效

转载 作者:搜寻专家 更新时间:2023-11-01 08:58:20 24 4
gpt4 key购买 nike

我正在尝试将 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

如有任何帮助,我们将不胜感激。

最佳答案

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

jstring Java_com_incket_OnePlayRL_OnePlayRL_uniqueCode(...)

关于android - decodeIndirectRef 中的间接引用无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17236365/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com