Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No rule to make target" when compiling NDK sources on Windows with Gradle

I am attempting a basic Android app containing an NDK library built from source. I get the following error when building :

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 looks odd to me. The makefile generated by 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 am using

  • gradle plugin 0.9
  • NDK r9d for Windows x64

I'd appreciate any help. I've got some experience with gradle and GNU build tools but I'm new to Android and the NDK.

like image 235
Andrew Marshall Avatar asked Mar 17 '14 21:03

Andrew Marshall


2 Answers

Like Selvin said, it should be fine as soon as you add another source file. Even an empty one will do the trick.

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

like image 110
ph0b Avatar answered Oct 22 '22 14:10

ph0b


Just go to Terminal and write

1: cd your_path_to\src\main\jni

2: ndk-build

like image 2
NickUnuchek Avatar answered Oct 22 '22 13:10

NickUnuchek