diff options
| author | landerlyoung <landerlyoung@gmail.com> | 2024-08-20 17:08:51 +0800 |
|---|---|---|
| committer | LanderlYoung <LanderlYoung@users.noreply.github.com> | 2024-08-20 20:10:16 +0800 |
| commit | 162a972d87a2f0c9fc894f0c683b3ac168df19d4 (patch) | |
| tree | 1058636e0a451bee6473e262cc48f379e4c5b308 /sample-java/src | |
| parent | ad22ada9b7b30b26b6d1ba3911f615645e11374d (diff) | |
1. fix compile issue for non-android jni.h
2. add sample-java test
3. update Android gradle plugin version
Diffstat (limited to 'sample-java/src')
| -rw-r--r-- | sample-java/src/main/cpp/jni_onload.cpp | 21 | ||||
| -rw-r--r-- | sample-java/src/main/java/io/github/landerlyoung/jennysample/Main.java | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sample-java/src/main/cpp/jni_onload.cpp b/sample-java/src/main/cpp/jni_onload.cpp new file mode 100644 index 0000000..adef0db --- /dev/null +++ b/sample-java/src/main/cpp/jni_onload.cpp @@ -0,0 +1,21 @@ + +#include <jni.h> +#include "ComputeInNative.h" +#include "jnihelper.h" +#include "jenny_fusion_proxies.h" + +JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) { + JNIEnv* env; + if (vm->GetEnv(reinterpret_cast<void**>(&env), + JNI_VERSION_1_6) != JNI_OK) { + return -1; + } + ::jenny::Env::attachJvm(vm); + + auto ok = ComputeInNative::registerNativeFunctions(env) && + jenny::initAllProxies(env); + + assert(ok); + + return JNI_VERSION_1_6; +}
\ No newline at end of file diff --git a/sample-java/src/main/java/io/github/landerlyoung/jennysample/Main.java b/sample-java/src/main/java/io/github/landerlyoung/jennysample/Main.java index 66d5c9c..632da9c 100644 --- a/sample-java/src/main/java/io/github/landerlyoung/jennysample/Main.java +++ b/sample-java/src/main/java/io/github/landerlyoung/jennysample/Main.java @@ -33,5 +33,6 @@ public class Main { System.out.println("success=" + success + ", rsp=" + rsp); })); engine.release(); + System.out.println("Jenny sample-java test pass"); } } |
