Hi All, I have installed a simple Java App on my android device and trying to call some method in Java layer from an executable of a native module, which is also pushed inside the device. (Tried using the JNI interface on native side.)
I simply tried calling an example method: "exampleMethod()" inside the java class from the native layer as below :- Java class --> public class SettingsService extends Service { public static void exampleMethod() { print("exampleMethod called"); ... ... } } Native side --> void NativeClass::start_Java_Service() { JavaVM* jvm; JNIEnv* env; jint res; jclass settingsServiceClass; jmethodID method; jobjectArray applicationArgs; jstring applicationArg0; JavaVMInitArgs args; JavaVMOption options[1]; args.version = 0x00010002; args.nOptions = 1; options[0].optionString = "-Djava.class.path=."; args.options = options; args.ignoreUnrecognized = JNI_TRUE; res = JNI_CreateJavaVM(&jvm, &env, &args); if (res < 0) { printf("Can't create Java VM\n"); exit(1); } settingsServiceClass = (env)->FindClass("com/vendor/ settingsservice/SettingsService"); if (swiqiSettingsServiceClass == NULL) { printf("Can't find Java Class\n"); goto destroy; } ... ... ... } On running the .exe of the native side , I get the following exception --> [ java.lang.NoClassDefFoundError: com/vendor/settingsservice/ SettingsService at dalvik.system.NativeStart.main(Native Method) ] I understand that this problem might be related to the fact that the native layer is not able to access the java side class or rather some path setting is required here. I am not able to understand that how should I make the Java class accessible for my native layer. Is some classpath setting required here in case of using the android device ?, If so then kindly suggest how ? Thanks in advance. Ravi. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en