开发者

Building .so libraries on windows for use on android

开发者 https://www.devze.com 2023-03-12 04:35 出处:网络
I am building C libraries that will be used by an android app(through either JNI or the NDK, I\'ve never used the NDK though) and I am wondering what IDE/development environment is best to use? I\'ve

I am building C libraries that will be used by an android app(through either JNI or the NDK, I've never used the NDK though) and I am wondering what IDE/development environment is best to use? I've basically only used Visual Studio for native development and I'm not sure how to adapt to building .so l开发者_运维技巧ibraries for use on android.

Thanks

EDIT: Update -- I want to avoid makefiles if possible (never used them) and rather use a complete IDE such as the case with visual stuido to compile


Generally, cygwin (i.e. command line) is used for building Android native code. But you can also try to use Eclipse for this purpose. It doesn't help very much but it highlights syntax and you don't have to switch to other apps to write code and build your app. You can read more about using Eclipse for C/C++ Android development here.


I would strongly recommend that you use the NDK's compiler.

Normally this is done by writing an Android.mk in accordance with the instructions for the NDK. It is not complicated. The easiest thing to do is to grab the hello-jni sample app and just make the necessary changes, for example substituting your source files into its android.mk.

You can stay in visual studio if you like that as an editing environment, simply using the ability to bind an external command to a keystroke to launch the ndk build script. Ages ago I had figured out how to reformat GCC error messages with sed into something that VS could parse to make them click-able, though I soon moved development of that project under linux.


I think a lot of people use Eclipse as their IDE for Android development. I use it and its pretty good. You shouldn't have any problems if you're used to VS.


The Android SDK comes with a plugin, the Android Development Tools (ADT), to develop applications for Android inside the Eclipse IDE, which is same kind of beast as Visual Studio. And within that IDE, it is possible to use JavaCPP (disclaimer: I am the author) to have it compile all the native C/C++ stuff we need through the Android NDK, but without needing Makefiles and such. More details here:

http://code.google.com/p/javacpp/#Instructions_for_Android

0

精彩评论

暂无评论...
验证码 换一张
取 消