zoukankan      html  css  js  c++  java
  • 005 android jni 一个简单的报错

    在android中使用ndk开发需要使用到jni。

    1. java.lang.UnsatisfiedLinkError: No implementation found for void com.frank.smart.smarthome.JniSocket.test() (tried Java_com_frank_smart_smarthome_JniSocket_test and Java_com_frank_smart_smarthome_JniSocket_test__)

    原因:
    public class JniSocket {
    static {
    System.loadLibrary("SmartSocket");
    }

        public native void test();
    }
    

    其中指令没有被执行,改为如下运行正常;
    public class JniSocket {

        JniSocket()
        {
            //static {
                System.loadLibrary("SmartSocket");
    
        }
        public native void test();
    }
    

    检查jni类似错误的方法

    1. 确保System.loadLibrary()函数一定被执行了加载了库。
    2. 对应函数函数名是否正确;
    3. 对应参数是否正确;
  • 相关阅读:
    各职业岗位说明
    感慨集中所
    批量插入测试数据
    写作技巧
    Cordova学习
    CocoStudio
    maven使用感受
    org.json
    ApplicationContext
    2017
  • 原文地址:https://www.cnblogs.com/fly-fish/p/4916833.html
Copyright © 2011-2022 走看看