"There is no rule to create a target" when compiling NDK sources on Windows using Gradle

I am trying to create a basic Android application containing an NDK library created from source code. When creating, I get the following error:

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 

The target path seems strange to me. The make file created with gradle looks like this:

 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) 

I use

  • gradle plugin 0.9
  • NDK r9d for Windows x64

I would be grateful for any help. I have experience with gradle and GNU tools, but I am new to Android and NDK.

+8
android-gradle android-ndk
source share
2 answers

As Selvin said, everything should be fine as soon as you add another source file. Even empty will do the trick.

I filled out a bug report with additional information: https://code.google.com/p/android/issues/detail?id=66937

+10
source share

Just go to Terminal and write

1: cd your_path_to \ src \ main \ jni

2: ndk-build

+2
source share

All Articles