android ndk-build error

只谈情不闲聊 提交于 2019-12-10 15:59:56

问题


I am trying to build tesseract for android. I have put tesseract in samples folder as

C:\Android_NDK\android-ndk-r8\samples\tesseract with in tesseract folder I have tesseract-3.00 folder, leptonlib-1.66 folder and libjpeg folder. Whenever I try to build the code using ndk-build. I get error as

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

I use ndk-build like this in Command Prompt C:\Android_NDK\android-ndk-r8\samples\tesseract\jni>C:\Android_NDK\android-ndk-r8/ndk-build

Application.mk file contents in tesseract/jni folder
# 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

Tried with Cygwin but the same problem.

Looking forward to your reply.

thanks.


回答1:


I think you not added below code to your buid.gradle file .This solution fo android studio

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


来源:https://stackoverflow.com/questions/11155054/android-ndk-build-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!