Android NDK: Trying to define local module ‘payload’ in jni/payload/Android.mk

Issue

OK so i’m trying to build this project: https://github.com/flysands/injector using NDK, but i get this error:

No, its not my NDK, i’ve tried to build other projects and it worked before.

Android NDK: Trying to define local module 'payload' in jni/payload/Android.mk.
Android NDK: But this module was already defined by jni/payload/Android.mk.

Any help is appriciated!

Solution

https://github.com/flysands/injector/blob/master/jni/Android.mk is wrong. subdirs is never initialized. ndk-build evaluates each Android.mk once per ABI, so when it evaluates the file for the second ABI it adds the subdirectories to subdirs a second time and causes the duplicate inclusion.

subdirs : $(LOCAL_PATH)/payload/Android.mk $(LOCAL_PATH)/inject/Android.mk

Answered By – Dan Albert

Leave a Comment