我创建了一个名为*args
的项目,然后在项目的根目录中创建了一个名为NDKTest3
的文件夹,并将这3个文件放在其中:
Android.mk:
jni
Application.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ndktest3
LOCAL_SRC_FILES := test.c
include $(BUILD_SHARED_LIBRARY)
include $(LOCAL_PATH)/../tesseract/android/jni/Android.mk
test.c的:
APP_ABI := all
我还编辑了我的`build.gradle(app),如下所示:
(blank)
settings.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.m.ndktest3"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk{
moduleName "ndktest3"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild{
ndkBuild{
path '../jni/Android.mk'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
然后我将include ':app'
include ':tesseract'
文件夹复制到项目的根目录中。您可以在下面看到我的项目:
但是当我想要同步项目时,它会给我这个错误消息:
tesseract