我能够很好地遵循jni教程.但是当我改变方法名称时,我遇到了麻烦.我需要遵循命名约定吗?本教程使用HelloJNI作为模块名称和库名称.我用过"useaaacom".
我得到了很好的反馈,我正在取得进展.我有一个相关的问题; 如果我应该为它创建另一个帖子,请告诉我.我喜欢在此应用程序上构建,此应用程序在此时运行.如何从设备驱动程序调用函数?我有头文件,驱动程序加载到我的图像.根据"我的意思",我是否需要在项目中获得头文件的副本?此设备驱动程序是供应商实现的,即它不是AOSP的一部分.自从我下载整个开源项目并构建它以来,我确实有它的副本.所以我要问的是我在apk中需要什么才能让app调用属于活动设备驱动程序的函数?
让我知道我是否应该更多地解释它的任何部分,或者我需要发布头文件或....
我已经验证我可以使用以下代码行打开设备驱动程序:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv)
{
/* Our file descriptor */
int fd;
int rc = 0;
char *rd_buf[16];
printf("%s: entered\n", argv[0]);
/* Open the device */
fd = open("/dev/hello1", O_RDWR);
if ( fd == -1 ) {
perror("open failed");
rc = fd;
exit(-1);
}
printf("%s: open: successful\n", argv[0]);
/* Issue a read */
rc = read(fd, rd_buf, 0);
if ( rc == …Run Code Online (Sandbox Code Playgroud) java java-native-interface android device-driver linux-device-driver