2
我想在Android Studio中的Java代碼中包含來自DetectText的現有C++文件。在Android Studio中使用現有的C++文件
通常(在Linux下),我被命令 ./TextDetection input_file output_file dark_on_light
運行它。
我已經與NDK編譯獲得SWT.a文件有:
LOCAL_PATH := $(call my-dir)
# static library info
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_core
LOCAL_SRC_FILES := opencv/lib/libopencv_core.a
include $(PREBUILT_STATIC_LIBRARY)
# static library info
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_opencv_highgui
LOCAL_SRC_FILES := opencv/lib/libopencv_highgui.a
include $(PREBUILT_STATIC_LIBRARY)
# static library info
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_imgproc
LOCAL_SRC_FILES := opencv/lib/libopencv_imgproc.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := SWT
LOCAL_C_INCLUDES := jni/opencv/include/
LOCAL_C_INCLUDES += jni/boost/include/boost-1_53
LOCAL_SRC_FILES := FeaturesMain.cpp \
TextDetection.cpp
include $(BUILD_STATIC_LIBRARY)
但現在我需要實現的包裝,我有點失落。我只是想調用Java部分的主要方法(調用另一種方法等)。
是否需要將所有方法名稱更改爲類似Java_com_example_hellojni_HelloJni_stringFromJNI
或只是主要方法?
那麼論點呢?
你必須在描述你的問題時更具體一些。 _「不起作用」_可能意味着什麼。 – Michael
我已更新它。 – Kraft