Using a library as a prebuilt library
The previous recipe described how to build an existing library
with its own build system. We obtained a compiled static library libbmp.a
of the open source libbmp
library. This recipe will discuss how to use a prebuilt library.
How to do it...
The following steps build an Android NDK application which uses prebuilt library. Note that the sample project is based on what we have done in the previous recipe. If you have not gone through previous recipe, you should do it now.
Open the
PortingWithBuildSystem
project that you created in previous recipe. Add a Java fileMainActivity.java
under thecookbook.chapter8.portingwithbuildsystem
package. This Java file simply loads the shared libraryPortingWithBuildSystem
, and calls the native methodnaCreateABmp
.Add the
mylog.h
andPortingWithBuildSystem.c
files under it.PortingWithBuildSystem.c
implements the native methodnaCreateABmp
.Create an
Android.mk
file under thejni
folder to compilePortingWithBuildSystem...