1:先说下demo的大概过程吧

a:首先呢,配置环境

jni开发中遇到的问题2:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved等等

b:项目添加本地支持

项目---->右键------->AndroidTools----->add native...

c:在MainActivity里面写个本地方法

jni开发中遇到的问题2:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved等等

使用javah命令生成对应的c代码

jni开发中遇到的问题2:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved等等


2:报错的处理(在生成的.h文件里面)

jni开发中遇到的问题2:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved等等

a:首先是#include<jni.h>找不到.h的文件

我的解决方法是:

jni开发中遇到的问题2:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved等等



b:Unable to launch cygpath. Is Cygwin on the path?] java.io.IOException: Cannot run program "cygpath": CreateProcess error=2, 系统找不到指定的文件。

jni开发中遇到的问题2:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved等等

对于这个的处理我是选择忽略,没影响


c:Type 'JNIEnv' could not be resolved/Type 'jobject' could not be resolved

经过a步骤之后,一般就不会在报错了,如果还报错的话,可以尝试删掉之前生成的.h文件,重新使用javah命令生成对应的.h文件





相关文章:

  • 2021-05-16
  • 2021-07-23
  • 2022-12-23
  • 2021-10-27
  • 2022-01-18
  • 2022-12-23
  • 2022-02-14
  • 2021-08-18
猜你喜欢
  • 2022-01-08
  • 2021-09-05
  • 2021-09-02
  • 2021-09-29
  • 2021-10-25
  • 2021-06-07
  • 2021-12-18
相关资源
相似解决方案