Android NDK:Eclipse 参数和 javah
我花了好几个小时在上面,却没有前进一寸。我已经重做了好几次这个项目了,没有任何东西留在外面的地方。希望这里有人能指出一些方向。
在 Linux Eclipse IDE 面板上 >运行>外部工具>外部工具配置:
Name: Dev javah
Tab [main]:
* location: /usr/java/jdk1.6.0_25/bin/javah
* working directory: ${workspace_loc:/Dev/bin}
* Arguments: ??
我已经尝试过:
* Arguments: -d ${workspace_loc:/Dev/jni} com.dev.DevActivity ${project_classpath:Dev} com.pkgpub.DevActivity
这给了我:
1 error
javadoc: error - Illegal package name: "/home/user/dev/Dev/bin/classes"
并且还尝试了:
* Arguments: -d ${workspace_loc:/Dev/jni} com.dev.DevActivity
这给了...
error: cannot access com.dev.DevActivity
class file for com.dev.DevActivity not found
javadoc: error - Class com.dev.DevActivity not found.
Error: No classes were specified on the command line. Try -help.
类似于 -
* Arguments: -d ${workspace_loc:/Dev/jni} com.pkgpub.DevActivity
这给了我:
error: cannot access com.pkgpub.DevActivity
class file for com.pkgpub.DevActivity not found
javadoc: error - Class com.pkgpub.DevActivity not found.
Error: No classes were specified on the command line. Try -help.
但是当我运行时:
which javah
/usr/bin/which: no javah in (/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/user/android-sdks/tools:/home/user/android-sdks/platform-tools:/opt/android/android-ndk-r7:/home/user/.local/bin:/home/user/bin:/home/user/android-sdks/tools:/home/user/android-sdks/platform-tools:/opt/android/android-ndk-r7:/home/user/android-sdks/tools:/home/user/android-sdks/platform-tools:/opt/android/android-ndk-r7)
问题是...项目没有编译,因为 javah 对Eclipse NDK,或者由于参数细节缺少某些内容?在这种情况下,如何修复它?
谢谢。
I spent hours and hours on it not moving an inch forward. I have redone the project several times and nothing else is left outside places. Hope someone here can shed some light pointing out some direction.
On Linux Eclipse IDE panel > Run > External Tools > External Tools Configurations:
Name: Dev javah
Tab [main]:
* location: /usr/java/jdk1.6.0_25/bin/javah
* working directory: ${workspace_loc:/Dev/bin}
* Arguments: ??
I have tried:
* Arguments: -d ${workspace_loc:/Dev/jni} com.dev.DevActivity ${project_classpath:Dev} com.pkgpub.DevActivity
which gives me:
1 error
javadoc: error - Illegal package name: "/home/user/dev/Dev/bin/classes"
and also tried:
* Arguments: -d ${workspace_loc:/Dev/jni} com.dev.DevActivity
That gives...
error: cannot access com.dev.DevActivity
class file for com.dev.DevActivity not found
javadoc: error - Class com.dev.DevActivity not found.
Error: No classes were specified on the command line. Try -help.
similarly to -
* Arguments: -d ${workspace_loc:/Dev/jni} com.pkgpub.DevActivity
That gives me:
error: cannot access com.pkgpub.DevActivity
class file for com.pkgpub.DevActivity not found
javadoc: error - Class com.pkgpub.DevActivity not found.
Error: No classes were specified on the command line. Try -help.
But when I run:
which javah
/usr/bin/which: no javah in (/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/user/android-sdks/tools:/home/user/android-sdks/platform-tools:/opt/android/android-ndk-r7:/home/user/.local/bin:/home/user/bin:/home/user/android-sdks/tools:/home/user/android-sdks/platform-tools:/opt/android/android-ndk-r7:/home/user/android-sdks/tools:/home/user/android-sdks/platform-tools:/opt/android/android-ndk-r7)
The question is... the project is not compiling because javah is not visible to Eclipse NDK, or due to parameter details that something is missing? And in such case, how to get it fixed?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试添加
作为 javah 的参数
try adding
as parameter to javah
特别适用于 Android:
在 bin 之后使用类,例如
project_location/bin/classes
,这在 Linux Fedora 上对我有用Specially for Android:
use classes right after bin like
project_location/bin/classes
, this worked for me on Linux Fedora@BlackBelt - 谢谢你的建议!
这是有效的参数,解决了编译过程的 javah 方面的问题:
其中 pkgpub 是包名称,Dev 是项目名称。值得一提的是,该项目有以下文件:\src\Dev.java; \jni\Dev.c; \jni\Dev.h; \bin...\pkgpub\Dev.class。
现在它生成具有正确内容的文件 jni/com_pkgpub_Dev.h。这太棒了!
然而 ndk-build 仍然没有完全链接,并且没有生成 com_pkgpub_Dev.c 文件。所以,从项目>项目构建 - 出现消息:
从该消息看来,文件 /jni/Android.mk 中应该缺少某些参数:
要解决此问题,只需创建缺少的文件“jni/com_pkgpub_Dev.c”。该文件内容应根据文件“jni/com_pkgpub_Dev.h”中包含的自动生成的代码手动制作。
现在,它起作用了!
@BlackBelt - thanks man for your suggestion!
Here is the parameter that worked, solving the javah side for the compiling process:
Where pkgpub is the package name, and Dev is the project name. It is worth to mention that the project has the files: \src\Dev.java; \jni\Dev.c; \jni\Dev.h; \bin...\pkgpub\Dev.class.
Now it generates the file jni/com_pkgpub_Dev.h with the right content. Which is great!
However the ndk-build is still not completely linking, and does not generate the com_pkgpub_Dev.c file. So, from Project > Project Build - comes the message:
From this message it sounds like some parameter should be missing from the file /jni/Android.mk:
To solve it, it is just necessary to create the missing file "jni/com_pkgpub_Dev.c". This file content should be manually made based on the automatic generated code contained in the file "jni/com_pkgpub_Dev.h".
Now, it works!