簡體   English   中英

Android NDK構建錯誤

[英]android ndk-build error

我正在嘗試為Android構建tesseract。 我已經將tesseract放在示例文件夾中

C:\\Android_NDK\\android-ndk-r8\\samples\\tesseracttesseract文件夾中,我有tesseract-3.00文件夾, leptonlib-1.66文件夾和libjpeg文件夾。 每當我嘗試使用ndk-build構建代碼時。 我得到錯誤

C:/Android_NDK/android-ndk-r8/build/core/build-binary.mk:240: *** target pattern contains no '%'. Stop.

我在命令提示符C:\\Android_NDK\\android-ndk-r8\\samples\\tesseract\\jni>C:\\Android_NDK\\android-ndk-r8/ndk-build

tesseract / jni文件夾中的Application.mk文件內容
# ARMv7 is significanly faster due to the use of the hardware FPU
APP_STL := gnustl_static
APP_ABI := armeabi armeabi-v7a
APP_OPTIM := release
APP_CPPFLAGS += -fexceptions -frtti

 Android.mk file contents in tesseract/jni folder  
# NOTE: You must set these variables to their respective source paths before
# compiling. For example, set LEPTONICA_PATH to the directory containing
# the Leptonica configure file and source folders. Directories must be
# root-relative, e.g. TESSERACT_PATH := /home/username/tesseract-3.00
#
# To set the variables, you can run the following shell commands:
# export TESSERACT_PATH=<path-to-tesseract>
# export LEPTONICA_PATH=<path-to-leptonica>
# export LIBJPEG_PATH=<path-to-libjpeg>
#
# Or you can fill out and uncomment the following definitions:
# TESSERACT_PATH := <path-to-tesseract>
# LEPTONICA_PATH := <path-to-leptonica>
# LIBJPEG_PATH := <path-to-libjpeg>

ifeq "$(TESSERACT_PATH)" ""
  $(error You must set the TESSERACT_PATH variable to the Tesseract source \
      directory. See README and jni/Android.mk for details)
endif

ifeq "$(LEPTONICA_PATH)" ""
  $(error You must set the LEPTONICA_PATH variable to the Leptonica source \
      directory. See README and jni/Android.mk for details)
endif

ifeq "$(LIBJPEG_PATH)" ""
  $(error You must set the LIBJPEG_PATH variable to the Android JPEG \
      source directory. See README and jni/Android.mk for details)
endif

# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles) $(LIBJPEG_PATH)/Android.mk

與Cygwin嘗試過,但存在相同的問題。

期待你的回復。

謝謝。

我認為您沒有將以下代碼添加到您的buid.gradle文件中。此解決方案適用於android studio

 sourceSets.main {
    jniLibs.srcDir 'src/main/libs'
    jni.srcDirs = [] //disable automatic ndk-build call
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM