diff options
author | Tom Murphy <tomnom@google.com> | 2022-12-16 19:30:37 +0000 |
---|---|---|
committer | Tom Murphy <tomnom@google.com> | 2022-12-22 14:04:40 +0000 |
commit | 6c4b31a7b584f0c2106c8100884d0452a15f6ca2 (patch) | |
tree | 2966d7c4ec1f96ba3bfc6a5dc060b4895d64158d | |
parent | 33ba3a8452ebb1a28903b2f1a81eecbb3f8e864a (diff) | |
download | gamesdk-6c4b31a7b584f0c2106c8100884d0452a15f6ca2.tar.gz |
Register native methods when using classLoader
Registering the methods explicitly helps customers who wrap the static swappy
library in a dynamic library.
Bug: 262688443
Test: Tested on emulator using debugger
Change-Id: Ice5216b296ab845832ef1096952a2f8409deba65
-rw-r--r-- | src/common/JNIUtil.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/JNIUtil.h b/src/common/JNIUtil.h index decfd01b..702e24d0 100644 --- a/src/common/JNIUtil.h +++ b/src/common/JNIUtil.h @@ -231,6 +231,10 @@ static jclass loadClass(JNIEnv* env, jobject activity, const char* name, env->DeleteLocalRef(imclassloaderClass); } #endif // #ifdef ANDROIDGAMESDK_NO_BINARY_DEX_LINKAGE + } else { + // Register the native methods loaded by the classLoaderClass + env->RegisterNatives(targetClass, nativeMethods, + nativeMethodsSize); } env->DeleteLocalRef(className); return targetClass; |