机器人无法找到相应的JNI函数 [英] android cannot find corresponding jni function

查看:217
本文介绍了机器人无法找到相应的JNI函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照 https://github.com/GerardSoleCa/Robosodium ,然后我添加的.so文件,我的Andr​​oid项目。加载库和项目运行。

现在我想用的库函数。我试着像这样在我的mainactivity:

 公共最后静态本地INT crypto_aead_chacha20poly1305_encrypt(字节[] jarg1,INT [] jarg2,字节[] jarg3,INT jarg4,字节[] jarg5,INT jarg6,字节[] jarg7,字节[] jarg8,字节[] jarg9);

Android的给我说,他无法找到相对应的JNI功能。

在这样的文件是在正确的架构图jniLibs。

有这个东西跟我的包名,他试图找到它在我的包,而不是在这么库?

当我运行此我得到:

  java.lang.UnsatisfiedLinkError中:未找到INT be.example.libtest.MainActivity.crypto_aead_chacha20poly1305_encrypt(字节[]的实施,INT [],字节[],INT,字节[] ,INT,字节[],字节[],字节[])(试过Java_be_example_libtest_MainActivity_crypto_1aead_1chacha20poly1305_1encrypt和Java_be_example_libtest_MainActivity_crypto_1aead_1chacha20poly1305_1encrypt___3B_3I_3BI_3BI_3B_3B_3B)


解决方案

我看到的 Robosodium 使用痛饮以生成包装。在这种情况下,应该还一些自动生成的Java文件的src / main / JAVA /组织/ abstractj /钾需要被添加到您的项目也是如此。所有本地调用应采用的类提供的方法进行。

I've followed https://github.com/GerardSoleCa/Robosodium and I've added the .so files to my android project. Loaded the library and the project runs.

Now I want to use a function of the library. I tried like this in my mainactivity:

public final static native int crypto_aead_chacha20poly1305_encrypt(byte[] jarg1, int[] jarg2, byte[] jarg3, int jarg4, byte[] jarg5, int jarg6, byte[] jarg7, byte[] jarg8, byte[] jarg9);

Android gives me that he cannot find the corresponding JNI function.

The so files are in jniLibs in the right architecture map.

Has this something to do with my packagename that he tries to find it in my package instead of in the so library?

When I run this I get:

java.lang.UnsatisfiedLinkError: No implementation found for int be.example.libtest.MainActivity.crypto_aead_chacha20poly1305_encrypt(byte[], int[], byte[], int, byte[], int, byte[], byte[], byte[]) (tried Java_be_example_libtest_MainActivity_crypto_1aead_1chacha20poly1305_1encrypt and Java_be_example_libtest_MainActivity_crypto_1aead_1chacha20poly1305_1encrypt___3B_3I_3BI_3BI_3B_3B_3B)

解决方案

I see that Robosodium uses Swig to generate wrapper. In this case there should be also some automatically generated Java files in src/main/java/org/abstractj/kalium that need to be added to your project as well. All native calls should be made using methods provided in that classes.

这篇关于机器人无法找到相应的JNI函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆