JNI の実装方法に応じて、2 つの可能な方法があるため、c/c++ 側を変更する必要があります。
A. 関数名には完全なクラスパスが含まれています
JNIEXPORT jlong JNICALL Java_"package with underscore instead of .""class""method"(JNIEnv *env, jclass class,...
例えば
JNIEXPORT jlong JNICALL Java_com_android_mms_transaction_NativeSms_send(JNIEnv *env, jclass class,...
パッケージ com.android.mms.transaction のクラス NativeSms の match メソッド send
B. クラスパスとともに dalvik/javaVM に返される文字列があります。次のようなものを探します。
static int registerMethods(JNIEnv* env) {
static const char* const kClassName =
"com/example/android/platform_library/PlatformLibrary";
jclass clazz;
/* look up the class */
clazz = env->FindClass(kClassName);
if (clazz == NULL) {
LOGE("Can't find class %s\n", kClassName);
return -1;
}
/* register all the methods */
if (env->RegisterNatives(clazz, gMethods,
sizeof(gMethods) / sizeof(gMethods[0])) != JNI_OK)
{
LOGE("Failed registering methods for %s\n", kClassName);
return -1;
}
...
編集 2011-12-07 最初の例を明確化