android - 简单的 JNI 示例 Android

标签 android linux java-native-interface classpath

我正在尝试创建一个简单的 Android-JNI 示例,但在尝试生成头文件时出现错误。 我正在关注的链接是:

http://www.ntu.edu.sg/home/ehchua/programming/android/android_ndk.html

我在第二步中遇到错误:

javah -classpath ../../bin/classes;<ANDROID_SDK_HOME>\platforms\android-<xx>\android.jar 
 -o HelloJNI.h com.mytest.JNIActivity

我根据下面提到的用例修改了命令: 错误:

 [SimpleJni]#javah -classpath ./bin/classes;/home/xxxxxx/Documents/8.7.14ADT/adt-bundle-linux-x86-20140702/sdk/platforms/android-18/android.jar com.example.simplejni.JNIActivity
Error: no classes specified
bash: /home/xxxxxx/Documents/8.7.14ADT/adt-bundle-linux-x86-20140702/sdk/platforms/android-18/android.jar: cannot execute binary file

我无法理解这个问题。我也检查了 jar 文件的权限,并将其设置为 755。 我还应该做什么?我哪里做错了?任何帮助表示赞赏。 提前致谢。

最佳答案

这应该可行

javah -classpath ../../bin/classes/ -bootclasspath /home/xxxxxx/Android/Sdk/platforms/android-23/android.jar -o HelloJNI.h com.mytest.JNIActivity

关于android - 简单的 JNI 示例 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26994675/

相关文章:

java - Delphi有没有相当于java的OnReceive函数?

java - JNI CameraPreview 使用 opencv 绘制矩形

android - 在Android中,如何在jni_onLoad方法中加载其他共享库?

linux - 使用 sed 将 crontab 文件中的文本替换为斜线

c - 如何解决 VSCode 中的“"Could not find the task ' gcc build active file.”错误?

linux - 我如何检查两个文件夹在 linux 中是否相同

java 。 JNI。 jvm.dll

android startActivityForResult 正在终止父 Activity 中的线程

java - onactivityresult() 永远不会被调用

android - 谷歌应用开发者 : Change Default Language of App