So, I have a little C library. I want to make this library available to other devs that develop native C code in android (other libraries, native apps etc).
我有一个C库。我想把这个库提供给在android中开发本机C代码的其他开发人员(其他库、本机应用程序等)。
What's the best way to go? I don't really have much clue yet, trying to figure all this out.
最好的方法是什么?我现在还不太清楚,想弄清楚这一切。
I've read that there are two paths to go with the NDK: using Android.mk and using create-standalone-toolchain -- is this correct? How does each one of these works? Is there a third way without the NDK, and should this be used now that the NDK is available?
我已经读到过,使用NDK有两条路可走:使用Android。mk以及使用createstandone工具链——这是正确的吗?它们是如何工作的?没有NDK还有第三种方法吗?现在可以使用NDK吗?
** This may have been asked before, but I understand things have changed since the release of the NDK, as a lot of posts I find seem obsolete.
**之前可能有人问过这个问题,但我知道自从NDK发布以来,事情发生了变化,因为我发现很多帖子似乎已经过时了。
1 个解决方案
#1
10
this question can have a Huge answer, I will try to be as brief as possible.
这个问题可以有一个巨大的答案,我会尽量简洁。
-
Using the Android NDK, make a new android project, create a JNI folder, and create an Android.mk file, in it, make two libs, one being your lib, exported as a shared lib and the other, a jniwrapper that will test it. Here is an example of how it was done by a guy for his own lib.
使用Android NDK,创建一个新的Android项目,创建一个JNI文件夹,并创建一个Android。在它的mkfile中,创建两个libs,一个是您的lib,导出为共享lib,另一个是jniwrapper,它将测试它。这里有一个例子,是一个人为了自己的*发挥而做的。
-
You can make a shared lib by compiling with the standalone toolchain, here is an article on the subject and also take a look at the curl Readme for android, it explains how to compile curl for Android using the standalone toolchain, I believe it's the better way to do it, and also to easier for you since you will use the cross-compiler in a regular fasion...
你可以共享的*与独立的编译工具链,这是一篇关于这个话题,也看看android旋度的自述,它解释了如何编译旋度为android使用独立的工具链,我相信这是更好的方法,也为你容易因为您将使用交叉编译器在一个常规时尚……
#1
10
this question can have a Huge answer, I will try to be as brief as possible.
这个问题可以有一个巨大的答案,我会尽量简洁。
-
Using the Android NDK, make a new android project, create a JNI folder, and create an Android.mk file, in it, make two libs, one being your lib, exported as a shared lib and the other, a jniwrapper that will test it. Here is an example of how it was done by a guy for his own lib.
使用Android NDK,创建一个新的Android项目,创建一个JNI文件夹,并创建一个Android。在它的mkfile中,创建两个libs,一个是您的lib,导出为共享lib,另一个是jniwrapper,它将测试它。这里有一个例子,是一个人为了自己的*发挥而做的。
-
You can make a shared lib by compiling with the standalone toolchain, here is an article on the subject and also take a look at the curl Readme for android, it explains how to compile curl for Android using the standalone toolchain, I believe it's the better way to do it, and also to easier for you since you will use the cross-compiler in a regular fasion...
你可以共享的*与独立的编译工具链,这是一篇关于这个话题,也看看android旋度的自述,它解释了如何编译旋度为android使用独立的工具链,我相信这是更好的方法,也为你容易因为您将使用交叉编译器在一个常规时尚……