Thanks for your tip, but the options does not work.may be I should check
android JNI spec firstly.

2009/9/16 fadden <fad...@android.com>

>
> (1) This discussion should be on android-ndk.
> (2) Make sure you have CheckJNI enabled (setprop dalvik.vm.checkjni
> true) if you're not on the emulator.
> (3) The logcat output will have some information about the crash that
> you should include.
>
>
> On Sep 15, 3:33 am, caval <cavalzh...@gmail.com> wrote:
> > firstly I save JVM pointer in a native function which called when ap
> > lauched:
> > JNIEXPORT void JNICALL Java_com_caval_ServerList_Init
> >   (JNIEnv * env, jobject obj)
> > {
> > ...
> >
> > *// save jvm pointer*
> > * **int nRt = env->GetJavaVM(&jvm);*
> >
> > if (nRt == 0)
> > fprintf(stdout, "InitDLNACP --> GetJavaVM Success...\n");
> > else
> > fprintf(stderr, "InitDLNACP --> GetJavaVM Failed...\n");
> >
> > }
> >
> > then, when some event echoed I will make a callback of some class in jvm
> >
> > void _callback()
> > {
> > JNIEnv *env = NULL;
> > int nResult = -1;
> >
> > *nResult = jvm->AttachCurrentThread((void **)&env, NULL);*
> > *if ((nResult != 0) || (env == NULL))*
> > {
> > fprintf(stderr, "--> In _Java_com_caval_now_Map_AddItem Thread Attached
> > Failed.\n");
> > return;
> >
> > }
> >
> > jstring ret = env->NewStringUTF(pszTitle); // I run to this line and ap
> > crashed.
> > jclass cls = env->FindClass("com/caval/now/ServerList");
> >
> > }
> >
> > the AttachCurrentThread func return OK and also I get the env pointer.
> > but any call on env will crash.
> >
> > I have no idea of this issue...any help will highly appriciated.
> >
> > Regards,
> > Caval.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to