8

Trying to run ndk-gdb and getting this error:

Android NDK installation path: /Library/AndroidSDK/ndk/
Using specific adb command: /Library/AndroidSDK/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using auto-detected project path: .
Found package name: com.dev.project
jni/Android.mk:18: * Android NDK: Aborting. . Stop.
ABIs targetted by application: Android NDK:
Device API Level: 17
Device CPU ABIs: armeabi-v7a armeabi
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: Android NDK:

The 18th line in the jni/Android.mk is an import module call.

What does that mean and how to remedy it?

App is debuggable as per ndk documentation. I'm using Mac. I can build and run the App, so build script should be fine.


Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := libgl2jni
LOCAL_CFLAGS    := -Werror -Wall -g
LOCAL_CPPFLAGS  := -std=c++11
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../src $(LOCAL_PATH)/../../include $(LOCAL_PATH)/../../../boost

NDK_MODULE_PATH := $(LOCAL_PATH)/../../lib/ndk
LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/../../src/*/*.cpp))
LOCAL_LDLIBS    := -llog -lGLESv2

LOCAL_STATIC_LIBRARIES := freetype

include $(BUILD_SHARED_LIBRARY)

$(call import-module,otherlib) #commenting this line launches the ndk-gdb, but ndk-build fails

Application.mk

APP_STL := gnustl_static

#remove for release?
APP_ABI := armeabi armeabi-v7a 
APP_OPTIM := debug
Kimi
  • 13,621
  • 9
  • 55
  • 84
  • Can you put your Android.mk and Application.mk up so an experienced hand may see what has gone wrong? One possibility is that the library needs to be in a directory for the ABI eg: lib/armeabi – hack_on Feb 25 '13 at 21:03
  • The build script may be fine, but somehow the ndk-gdb is not seeing the ABIs that the build is building for. It is parsing your Android.mk and not finding the ABIs. – hack_on Feb 26 '13 at 13:53
  • $(call import-module,otherlib) is importing another project this may be interfering even though it builds. Can you rearrange to include a .so from the other project instead and at least see if that is the problem. It may not be exporting something. – hack_on Feb 27 '13 at 14:20

4 Answers4

9

I had the same problem. I'm quite sure it is a bug in the core/build-local.mk script. At least the error message is not meaningful.

I fixed doing this:

export NDK_MODULE_PATH=path_to_look_for_modules

Where path_to_look_for_modules should be the parent directory of your module declared in the Android.mk. That is, if you have /myproject/mylibs/otherlib export the path /myproject/mylibs

If you have several paths, as usual:

export NDK_MODULE_PATH=path1:path2:path3
Paglian
  • 6,162
  • 3
  • 26
  • 20
1

If you are building an Android app and have some ndk code you may be able to solve this problem by adding/modifying your Application.mk (usually in the jni directory) with the following line:

# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a x86 mips
#APP_ABI := armeabi
APP_PLATFORM := android-10

I mean the APP_ABI line. This is specifying the target processors to compile the ndk code for. I am assuming from the error message that you are testing on a device that has a different cpu type than the ones you built the app for.

Useful information about third party libraries

Possible issue with makefile or environment

Community
  • 1
  • 1
hack_on
  • 2,532
  • 4
  • 26
  • 30
  • Why would I need x86 and mips? I have APP_ABI := armeabi armeabi-v7a, it doesn't compile if I add x86 and mips... – Kimi Feb 25 '13 at 13:43
  • As long as that is what your device needs. It looks to me as though it is saying your app supports "Android NDK:" which may mean you have a bad command line, or make file. – hack_on Feb 25 '13 at 13:50
0

export NDK_PROJECT_PATH=[Path]

where [Path] is the parent of "jni" directory, which in turn contains your NDK code.

You "might" face this issue if your NDK code (jni directory) is located separately from your Android java code.

Venky
  • 179
  • 1
  • 4
0

A common solution to this problem is to include this line in your Application.mk.

APP_ABI := armeabi-v7a

Replace armeabi-v7a by the appropriate API as per the Device supports line. This will ensure that your application is built for the correct platform, and that ndk-gdb can find it.

david.pfx
  • 10,520
  • 3
  • 30
  • 63