我叫env->SetStaticIntField(cls, jfid, 0);
应用崩溃了。
addr2line工具发现了这一点:
/usr/local/google/buildbot/src/android/ndk-release-r19/external/libcxx/../../external/libcxxabi/src/cxa_demangle.cpp:2125
我的应用程序正在使用cmake_minimum_required(VERSION 3.4.1)
和cppFlags "-std=c++14"
像这样的c ++方法:
JNIEXPORT jint JNICALL
Java_zhumu_xiaot_com_ndkdemo_MainActivity_operateStaticInt(JNIEnv *env,
jobject instance) {
jclass cls = env->GetObjectClass(instance);
jfieldID jfid = env->GetStaticFieldID(cls, "staticint", "I");
jint jsataticint = env->GetStaticIntField(cls, jfid);
env->SetStaticIntField(cls, jfid, 80);
}