我正在尝试一个包含从源码构建的NDK库的基本Android应用。构建时出现以下错误:
gradlew assembleArm
:myapp:compileArmDebugNdk
make.exe: *** No rule to make target
`C:\Projects\MyApp\myapp\build\ndk\arm\debug\obj/local/armeabi-v7a/objs-debug/process/C_\Projects\MyApp\myapp\src\main\jni', needed by `C:\Projects\MyApp\myapp\build\ndk\arm\debug\obj/local/armeabi-v7a/objs-debug/process/C_\Projects\MyApp\myapp\src\main\jni\process.o'. Stop.
:myapp:compileArmDebugNdk FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myapp:compileArmDebugNdk'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\android-ndk-r9d\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Projects\MyApp\myapp\build\ndk\arm\debug\Android.mk APP_PLATFORM=android-18 NDK_OUT=C:\Projects\MyApp\myapp\build\ndk\arm\debug\obj NDK_LIBS_OUT=C:\Projects\MyApp\myapp\build\ndk\arm\debug\lib NDK_DEBUG=1 APP_STL=stlport_static APP_ABI=armeabi-v7a
目标路径对我来说很奇怪。 gradle生成的makefile如下所示:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := process
LOCAL_CFLAGS := -DANDROID_NDK
LOCAL_SRC_FILES := \
C:\Projects\MyApp\myapp\src\main\jni\process.cpp \
LOCAL_C_INCLUDES += C:\Projects\MyApp\myapp\src\main\jni
LOCAL_C_INCLUDES += C:\Projects\MyApp\myapp\src\arm\jni
LOCAL_C_INCLUDES += C:\Projects\MyApp\myapp\src\debug\jni
LOCAL_C_INCLUDES += C:\Projects\MyApp\myapp\src\armDebug\jni
include $(BUILD_SHARED_LIBRARY)
我正在使用
我很感激任何帮助。我在gradle和GNU构建工具方面有一些经验,但我是Android和NDK的新手。
答案 0 :(得分:10)
就像塞尔文说的那样,只要你添加另一个源文件就应该没问题了。即使是空洞的人也可以做到这一点。
我填写了一份错误报告,其中包含更多信息:https://code.google.com/p/android/issues/detail?id=66937
答案 1 :(得分:2)
转到终端并写下
1:cd your_path_to \ src \ main \ jni
2:ndk-build