search

Home  >  Q&A  >  body text

android - jni在getJavaVM之后获取JavaVm时候总是为NULL

我调用java中的jni, 定义了一个变量:
static JavaVM *pMyJavaVm=NULL,

并且在函数中赋值:
env->GetJavaVM(&pMyJavaVm);

但是当我要用到 pMyJavaVm的时候 打印发现 值为NULL ,这是为什么呢?

PHPzPHPz2887 days ago947

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 17:29:51

    The problem is solved, mainly due to the lack of thorough understanding of the C language. It is defined in a global header file, static JavaVM* pMyJavaVm; is included in several cpp files, and the variables in each file are independent, so Citing in other documents is problematic

    reply
    0
  • Cancelreply