| 120 | } |
| 121 | } |
| 122 | JNIEnv* GetEnv() { |
| 123 | CacheJavaVM(); |
| 124 | JNIEnv* env = NULL; |
| 125 | if (g_VM->GetEnv((void**)&env, JNI_VERSION_1_6) != JNI_OK) { |
| 126 | // 当前线程未附加,尝试 attach |
| 127 | if (g_VM->AttachCurrentThread(&env, NULL) != 0) { |
| 128 | Issue("Failed to attach current thread to JVM"); |
| 129 | } |
| 130 | } |
| 131 | return env; |
| 132 | } |
| 133 | JNIEXPORT void JNICALL Java_org_ippclub_dorassr_MainActivity_nativeSetMainActivityClass(JNIEnv* env, jclass, jclass cls) { |
| 134 | if (g_MainActivityClass) { |
| 135 | env->DeleteGlobalRef(g_MainActivityClass); |
no test coverage detected