我拥有一些.a文件,并希望使用ndk-build生成.so。
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)
使用NDK-build使用这些steps。
当试图生成.so时,这会给我带来这个错误:
C:\ Android \ sdk \ ndk-bundle \ build \ ndk-build.cmd clean Android NDK: jni / Android.mk中的LOCAL_MODULE定义不得包含空格
C:/ Android设备/ SDK / NDK束/建立//../构建/核心/ build-shared-library.mk:23: *** Android NDK:请更正错误。中止。停止。处理完成,退出代码为2
答案 0 :(得分:1)
LOCAL_MODULE
指定构建的最终.so文件的名称。
自space is introduced in the name when you concatenate the two strings nonfree
和opencv_java3
以来,ndk-build发出错误:
LOCAL_MODULE := nonfree
LOCAL_MODULE += opencv_java3
如果您想要连接名称,我建议您手动执行此操作:
LOCAL_MODULE := nonfree_opencv_java3
然后,当您通过JNI加载.so文件时,需要指定此名称。