我正在将一个Android库从Eclipse迁移到Android Studio。在Eclipse中,我可以通过Project > Properties > Resource > Linked Resources > Path Variables设置NDK_MODULE_PATH。但是,在Android Studio中,我该如何使用gradle实现同样的功能?
我的库构建过程一直持续到它尝试查找NDK_MODULE_PATH下模块的头文件。
以下是错误信息:
执行任务:[:libAndroid:compileDebugSources, :physicaloidLibrary:compileDebugSources]按需配置是一项孵化功能。 :libAndroid:preBuild已更新 :libAndroid:preDebugBuild已更新 :libAndroid:checkDebugManifest :libAndroid:preDebugAndroidTestBuild已更新 :libAndroid:preReleaseBuild已更新 :physicaloidLibrary:compileLint :physicaloidLibrary:copyReleaseLint已更新 :physicaloidLibrary:mergeReleaseProguardFiles已更新 :physicaloidLibrary:preBuild已更新 :physicaloidLibrary:preReleaseBuild已更新 :physicaloidLibrary:checkReleaseManifest :physicaloidLibrary:prepareReleaseDependencies :physicaloidLibrary:compileReleaseAidl已更新 :physicaloidLibrary:compileReleaseRenderscript已更新 :physicaloidLibrary:generateReleaseBuildConfig已更新 :physicaloidLibrary:generateReleaseAssets已更新 :physicaloidLibrary:mergeReleaseAssets已更新 :physicaloidLibrary:generateReleaseResValues已更新 :physicaloidLibrary:generateReleaseResources已更新 :physicaloidLibrary:packageReleaseResources已更新 :physicaloidLibrary:processReleaseManifest已更新 :physicaloidLibrary:processReleaseResources已更新 :physicaloidLibrary:generateReleaseSources已更新 :physicaloidLibrary:compileReleaseJava已更新 :physicaloidLibrary:processReleaseJavaRes已更新 :physicaloidLibrary:packageReleaseJar已更新 :physicaloidLibrary:compileReleaseNdk已更新 :physicaloidLibrary:packageReleaseJniLibs已更新 :physicaloidLibrary:packageReleaseLocalJar已更新 :physicaloidLibrary:packageReleaseRenderscript已更新 :physicaloidLibrary:bundleRelease已更新 :libAndroid:prepareLibAndroidGradlePhysicaloidLibraryUnspecifiedLibrary已更新 :libAndroid:prepareDebugDependencies :libAndroid:compileDebugAidl已更新 :libAndroid:compileDebugRenderscript已更新 :libAndroid:generateDebugBuildConfig已更新 :libAndroid:generateDebugAssets已更新 :libAndroid:mergeDebugAssets已更新 :libAndroid:generateDebugResValues已更新 :libAndroid:generateDebugResources已更新 :libAndroid:mergeDebugResources已更新 :libAndroid:processDebugManifest已更新 :libAndroid:processDebugResources已更新 :libAndroid:generateDebugSources已更新 :libAndroid:compileDebugJava已更新 :libAndroid:compileDebugNdk AGPBI:{"kind":"SIMPLE","text":"/home/rhodo/dev/android/studio/LibAndroidGradle/libAndroid/src/main/jni/imageprocessing/dmtxutil.c:30:18: fatal error: dmtx.h: No such file or directory","position":{},"original":"/home/rhodo/dev/android/studio/LibAndroidGradle/libAndroid/src/main/jni/imageprocessing/dmtxutil.c:30:18: fatal error: dmtx.h: No such file or directory"} AGPBI:{"kind":"SIMPLE","text":" #include \u003cdmtx.h\u003e","position":{},"original":" #include \u003cdmtx.h\u003e"} AGPBI:{"kind":"SIMPLE","text":" ^","position":{},"original":" ^"} AGPBI:{"kind":"SIMPLE","text":"compilation terminated.","position":{},"original":"compilation terminated."} AGPBI:{"kind":"SIMPLE","text":"make: *** [/home/rhodo/dev/android/studio/LibAndroidGradle/libAndroid/build/intermediates/ndk/debug/obj/local/arm64-v8a/objs/Rhodo//home/rhodo/dev/android/studio/LibAndroidGradle/libAndroid/src/main/jni/imageprocessing/dmtxutil.o] Error 1","position":{},"original":"make: *** [/home/rhodo/dev/android/studio/LibAndroidGradle/libAndroid/build/intermediates/ndk/debug/obj/local/arm64-v8a/objs/Rhodo//home/rhodo/dev/android/studio/LibAndroidGradle/libAndroid/src/main/jni/imageprocessing/dmtxutil.o] Error 1"}
失败
构建失败,出现异常。
* 出错内容: 执行任务':libAndroid:compileDebugNdk'失败。 > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/android-ndk/ndk-build'' finished with non-zero exit value 2
* 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项获取更多日志输出
有关此事有什么想法吗?