Reputation: 439
I own a number of .a files and would like to generate .so using ndk-build.
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := nonfree
LOCAL_MODULE += opencv_java3
LOCAL_SRC_FILES := \
libopencv_aruco.a \
libopencv_bgsegm.a \
libopencv_bioinspired.a \
libopencv_calib3d.a \
libopencv_ccalib.a \
libopencv_core.a \
libopencv_datasets.a \
libopencv_dnn.a \
libopencv_dpm.a \
libopencv_face.a \
libopencv_features2d.a \
libopencv_flann.a \
libopencv_fuzzy.a \
libopencv_highgui.a \
libopencv_imgcodecs.a \
libopencv_imgproc.a \
libopencv_line_descriptor.a \
libopencv_ml.a \
libopencv_objdetect.a \
libopencv_optflow.a \
libopencv_photo.a \
libopencv_plot.a \
libopencv_reg.a \
libopencv_rgbd.a \
libopencv_saliency.a \
libopencv_shape.a \
libopencv_stereo.a \
libopencv_stitching.a \
libopencv_structured_light.a \
libopencv_superres.a \
libopencv_surface_matching.a \
libopencv_text.a \
libopencv_tracking.a \
libopencv_ts.a \
libopencv_video.a \
libopencv_videoio.a \
libopencv_videostab.a \
libopencv_xfeatures2d.a \
libopencv_ximgproc.a \
libopencv_xobjdetect.a \
libopencv_xphoto.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
To use the NDK-build used these steps.
When trying to generate .so this returning me this error:
C:\Android\sdk\ndk-bundle\build\ndk-build.cmd clean Android NDK: LOCAL_MODULE definition in jni/Android.mk must not contain space
C:/Android/sdk/ndk-bundle/build//../build/core/build-shared-library.mk:23: *** Android NDK: Please correct error. Aborting . Stop.Process finished with exit code 2
Upvotes: 1
Views: 696
Reputation: 313
LOCAL_MODULE
specifies the name of the final .so file built.
ndk-build is giving an error since a space is introduced in the name when you concatenate the two strings nonfree
and opencv_java3
:
LOCAL_MODULE := nonfree
LOCAL_MODULE += opencv_java3
If you would like a concatenated name I would suggest doing this manually:
LOCAL_MODULE := nonfree_opencv_java3
You will then need to specify this name when you load the .so file through JNI.
Upvotes: 1