简体   繁体   中英

can I use a native library .so in android project without NDK?

我有一个用Android SDK在eclipse环境中构建的android项目,现在我想在这个项目中添加一个预构建的库(.so) ,我应该使用NDK吗?

不,只需在resjava文件夹的同一级别创建一个jniLibs文件夹,然后将.so文件放入其中。

you usually don't need to use the NDK to use a native library (.so file) from Java. You only need it if you want to create/recompile a .so file or if the .so files doesn't provide any method implementation to Java.

From where does come your library ? A .jar or a Java class should at least come with it.

In order to use your .so file from Java, you need to know what Java methods it's defining to define the same as native from your Java code, from the same class from the same package name the .so file is made for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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