I'm working on an Android application that is currently written fully in C++, implemented as a Native Activity and using CMake to build the project.
Currently, I'm looking at trying to call methods in a Java derived WebView class from C++, but am having difficulties with how to use build/use this class with the Native Activity.
My build.gradle
is located in the root of the project, and all of the C++ code is in src/
. Simply adding the Java file to the project, under src/main/java/com/my/app/CustomWebView.java
.
and calling:
JNIEnv * env = 0;
JNIEnv ** envptr = &env;
JavaVM * jniiptr = gapp->activity->vm;
jniiptr->AttachCurrentThread( (JNIEnv**)&env, 0 );
env = (*envptr);
jclass customWebViewClass = env->FindClass("com/my/app/CustomWebView");
Results in customWebViewClass
being null.
I am unsure on what I need to do for this to be found correctly. I haven't yet modified any build or manifest files (such as build.gradle
or AndroidManifest.xml
), and was wondering if I needed to for this java class to be found correctly?