android - native cpp 中有很多 Unresolved 错误

标签 android c++ eclipse android-ndk java-native-interface

我已经将一个项目导入到我的工作区中,之前它工作正常,但现在一旦我打开我的 cpp 文件,它就开始给我错误 xyz could not be resolved,其中 xyz 可以是任何字段或方法,这里是问题日志。

Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 112    Semantic Error
Method 'DetachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 112    Semantic Error
Method 'DetachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 83 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 112    Semantic Error
Method 'DetachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 71 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 77 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 71 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 71 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 83 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 83 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 77 Semantic Error
Method 'DetachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 77 Semantic Error
Method 'DetachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 34 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 34 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 59 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 59 Semantic Error
Invalid arguments '
Candidates are:
_jobject * CallObjectMethod(_jobject *, _jmethodID *, ...)
'   android_tools.cpp   /ImageTargets/jni   line 67 Semantic Error
Method 'DetachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 59 Semantic Error
Field 'clazz' could not be resolved android_tools.cpp   /ImageTargets/jni   line 67 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 67 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 17 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 17 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 17 Semantic Error
Field 'vm' could not be resolved    android_tools.cpp   /ImageTargets/jni   line 21 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 21 Semantic Error
Field 'activity' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 34 Semantic Error
Method 'AttachCurrentThread' could not be resolved  android_tools.cpp   /ImageTargets/jni   line 21 Semantic Error

由于这个问题,我无法在 jni 中打开我的 cpp 文件,我尝试建立索引但没有成功。如果我重新启动我的 eclipse,我的所有错误都消失了,如果我编译一切正常并且项目在设备上运行但是当我尝试打开我的 cpp 文件时问题开始出现,它开始给我这种错误。

最佳答案

右键单击项目 -> 属性 -> C/C++ 常规 -> 代码分析 -> 启动

取消选中两者,应用,然后你就可以开始了。

同样的答案可以在这里找到:Eclipse compiles successfully but still gives semantic errors

关于android - native cpp 中有很多 Unresolved 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22014318/

相关文章:

android - 自定义首选项,targetSdkVersion ="11": missing indent?

java - 如何在 Java 中解析 SAX 解析器中的嵌套元素?

android - 插入 sqlite 数据库时出错

android - 无法加载 memtrack 模块(没有这样的文件或目录)

android - ADB 在 Eclipse 中崩溃

android - 在android中禁用微调器

c++ - 告诉转义的十六进制在字符串中结束的位置

c++ - 一个 webview 如何填满整个页面?

C++ 游戏和装饰器模式

eclipse - 从 Eclipse 导出 WAR 文件时忽略 SVN 文件?