简体   繁体   English

HelloJNI Android'java.lang.UnsatisfiedLinkError:stringFromJNI'

[英]HelloJNI Android 'java.lang.UnsatisfiedLinkError: stringFromJNI'

I googled a lot for a solution for my problem but I have found anything that helped me. 我在Google上搜索了很多问题的解决方案,但发现有什么对我有所帮助。 I am an Android beginner and have problems with the HelloJNI sample from the Android NDK. 我是一名Android初学者,并且Android NDK中的HelloJNI示例存在问题。

I work with Eclipse and put the hello-jni.c file as well as the Android.mk in the jni/ folder of my Android project. 我使用Eclipse,并将hello-jni.c文件以及Android.mk放入我的Android项目的jni/文件夹中。 Then I put the Hellojni.java file into the src/ folder in a package. 然后,将Hellojni.java文件放入包中的src/文件夹中。 I can build the code with the ndk-build tool. 我可以使用ndk-build工具来构建代码。 So I get the hello-jni.so file which is put into libs/armeabi . 所以我得到了hello-jni.so文件,该文件放在libs/armeabi

Everything seems to be fine. 一切似乎都很好。 In the main activity of the Android project, I can create an object of Hellojni like Hellojni x = new Hellojni(); 在Android项目的主要活动中,我可以创建一个Hellojni对象,例如Hellojni x = new Hellojni(); . But when I try to open the function stringFromJNI like x.stringFromJNI(); 但是当我尝试打开x.stringFromJNI();类的函数stringFromJNI x.stringFromJNI(); the error occurs which I wrote in the title of this topic. 我在本主题标题中写的错误发生了。

Is there anything wrong? 有什么问题吗? Unfortunately the source code of the project is on another computer so that it is difficult to put it here. 不幸的是,该项目的源代码在另一台计算机上,因此很难将其放在此处。 But I could try to do that in case you need it to give me a hint. 但是我可以尝试这样做,以防您需要它给我提示。 Thanks in advance. 提前致谢。

你有这样称呼本地图书馆吗?

System.loadLibrary("hello-jni.so");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM