2023-01-19 361
我有一个带有本机函数的小JNI文件,该文件将字符数组转换为字节数组(因此我可以将其发送给我的C ++客户端).
定义如下:
JNIEXPORT jbyteArray JNICALL Java_com_example_comtesttcp_communicationmoduleTCPIP_ConvertString(
JNIEnv * env, jobject,
jcharArray Buffer)
软件包名称(加载库的位置是:
package com.example.communicationmoduleTCPIP
和同类中的本地deffiniton如下:
// Load helper functions library
static {
System.loadLibrary("HelperFunctions");
}
public native byte[] ConvertString(char[] Buffer);
但是,当调用转换串功能时,我会收到效率错误:
01-13 21:07:21.890: W/dalvikvm(22611): No implementation found for native Lcom/example/communicationmoduleTCPIP/communicationmoduleTCPIP;.ConvertString:([C)[B
01-13 21:07:21.890: W/dalvikvm(22611): threadid=11: thread exiting with uncaught exception (group=0x412b52a0)
01-13 21:07:21.900: E/AndroidRuntime(22611): FATAL EXCEPTION: Thread-821
01-13 21:07:21.900: E/AndroidRuntime(22611): java.lang.UnsatisfiedLinkError: Native method not found: com.example.communicationmoduleTCPIP.communicationmoduleTCPIP.ConvertString:([C)[B
01-13 21:07:21.900: E/AndroidRuntime(22611): at com.example.communicationmoduleTCPIP.communicationmoduleTCPIP.ConvertString(Native Method)
01-13 21:07:21.900: E/AndroidRuntime(22611): at com.example.communicationmoduleTCPIP.communicationmoduleTCPIP.SendBuffer(communicationmoduleTCPIP.java:164)
01-13 21:07:21.900: E/AndroidRuntime(22611): at com.example.communicationmoduleTCPIP.communicationmoduleTCPIP.RunServer(communicationmoduleTCPIP.java:107)
01-13 21:07:21.900: E/AndroidRuntime(22611): at com.example.communicationmoduleTCPIP.communicationmoduleTCPIP.run(communicationmoduleTCPIP.java:368)
01-13 21:07:21.900: E/AndroidRuntime(22611): at java.lang.Thread.run(Thread.java:856)
问题可能是类(CommunicationModuleTCPIP)是可运行的类?我没有参加课程,并且具有以下定义(当我评论本机函数时,服务器运行正常)
public class communicationmoduleTCPIP extends communicationmodule implements Runnable
我已经在网上环顾四周,在阅读了一些帖子后,我认为正确的定义,有人可以告诉我我在做什么错吗?欢迎任何建议.
本机方法名称应匹配全名:Java_com_example_communicationmoduleTCPIP_communicationmoduleTCPIP_ConvertString
以上所述是小编给大家介绍的没有找到本地方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!
原文链接:https://77isp.com/post/25799.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态