I am using ndk 12b or ndk 10d
I want to debug .so file in eclipse.
But I have a problem.
I tried to debug .so using android native application in "DEBUG AS".
But I received this result from console.
"gdbserver output: run-as: exec failed for lib/gdbserver Error:No such file or directory"
I set my android.mk and application.mk like this.
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.cpp
LOCAL_LDLIBS := -llog -landroid
APP_STL:=stlport_static
APP_OPTIM:=debug
APP_ABI := all
APP_CFLAGS += -Wno-error=format-security
LOCAL_LDFLAGS += --no-warn-shared-textrel
I also set NDK_DEBUG=1 as build option.
what should I do solve it?
Related
am compiling android ndk project but couldn't get it successfully done. It says no such file or directory found for Log header file at main.cpp file. I'm new to android ndk please help.
here is my android.mk file.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := user
LOCAL_ARM_MODE := arm
# This is the target being built.
LOCAL_MODULE := libemu
# All of the source files that we will compile.
LOCAL_SRC_FILES := \
ticks.c \
main.cpp \
emulator.cpp
# All of the shared libraries we link against.
LOCAL_SHARED_LIBRARIES := \
libdl \
libnativehelper \
libutils
# Static libraries.
LOCAL_STATIC_LIBRARIES :=
# Also need the JNI headers.
LOCAL_C_INCLUDES += \
$(JNI_H_INCLUDE)
# Special compiler flags.
LOCAL_CFLAGS += -O3 -fvisibility=hidden
# Don't prelink this library. For more efficient code, you may want
# to add this library to the prelink map and set this to true. However,
# it's difficult to do this for applications that are not supplied as
# part of a system image.
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)
here is the log
"Compile++ arm : emu <= main.cpp
D:/EclipseWorkspace/NineTendo//jni/main.cpp:2:23: fatal error: utils/Log.h: No such file or directory
compilation terminated.
make: *** [D:/EclipseWorkspace/NineTendo//obj/local/armeabi/objs/emu/main.o] Error 1
any help would be much appreciated.
Thanks
This error started to show up in NDK version R9x. You need to declare the API version number in your Application.mk file. Here's how it looks to define a minimum API level of 8:
APP_PLATFORM := android-8
The Application.mk file should live alongside your Android.mk file in the JNI directory. Here's a sample from one of my projects:
APP_ABI := armeabi armeabi-v7a x86
APP_CFLAGS += -O2
LOCAL_ARM_MODE := arm
APP_PLATFORM := android-8
when i run ndk-gdb in cgywin i get error saying "make: command not found" and "the device does not support the applications targetted CPU abi's"
$ ndk-gdb --verbose --nowait
Android NDK installation path: /cygdrive/c/Android/ndk
Using default adb command: /cygdrive/c/Android/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using JDB command:
Using auto-detected project path: .
Found package name: com.example.mygame
/cygdrive/c/Android/ndk/ndk-gdb: line 120: make: command not found
ABIs targetted by application:
Device API Level: 10
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.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := \
c:/cocos2d-x/external/Box2D
LOCAL_MODULE := mygame
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static box2d_static
LOCAL_SRC_FILES := \
b2DebugDraw.cpp \
Box2DRenderer.cpp \
Main.cpp \
InGameScreen.cpp
include $(BUILD_SHARED_LIBRARY)
$(call import-add-path, c:/cocos2d-x)
$(call import-add-path, c:/cocos2d-x/cocos2dx/platform/third_party/android/prebuilt)
$(call import-module, cocos2dx)
$(call import-module, external/Box2D)
Application.mk
APP_ABI := armeabi-v7a
APP_STL := gnustl_static
APP_OPTIM:= debug
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix -g
NDK_TOOLCHAIN_VERSION := 4.8
im using a kindle fire with 2.3.3 installed
The obvious first answer is that make.exe (GNU Make) needs to be in your path. Is it installed in Cygwin? Check the Cygwin installer.
I am trying to compile C++ code dependent on OpenCV on the Android NDK.
I have looked into several answers (mainly this) but apparently the NDK still cannot see the directory I'm giving it in the LOCAL_C_INCLUDES variable.
This is my Application.mk:
APP_ABI :=armeabi armeabi-v7a
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_PLATFORM :=android-14
NDK_TOOLCHAIN_VERSION=4.7
This is my Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= swt
LOAL_CPP_EXTENSIO:=.cpp
LOCAL_C_INCLUDES := /usr/include:/usr/include/i386-linux-gnu:/usr/include/i386-linux-gnu/bits:/usr/include/i386-linux-gnu/sys:/usr/include/i386-linux-gnu/gnu:/usr/include/i386-linux-gnu/asm:/home/hamdy/Downloads/android-ndk-r8e/sources:/usr/local/include/opencv:/usr/local/include/opencv2/core
LOCAL_CFLAFS := -x c++ -lopencv_core -lopencv_highgui -lopencv_imgproc
LOCAL_SRC_FILES := TextDetection.cpp FeaturesMain.cpp
include $(BUILD_SHARED_LIBRARY)
This is the error I'm getting [cv.h is the file included in my .cpp so it can apparently see that in the /usr/local/include/opencv directory but cannot get past the includes in it]:
/usr/local/include/opencv/cv.h:63:33: fatal error: opencv2/core/core_c.h: No such file or directory
compilation terminated.
I don't know why but when I've compiled the same under Linux everything compiled fine. Under Windows there were errors. So I've switched to Linux
I've created an Android Application Project in Eclipse Juno, and after I've added native support to this project (Android Tools -> Add Native Support). So Eclipse has added in the project automatically a jni directory, within which a .cpp file and the file Android.mk.
Then I've build the project, without errors.
In order to use opencv for android libraries (2.4.5), I've added the path to the 'include' directory of these libraries in the project (Properties -> C/C++ General -> Path And Symbols -> Include Diretories). I've also set in the Eclipse Preferences -> NDK the correct path to the ndk directory in my pc, to make possible to execute ndk-build when I build the projects.
But, if i try to include in the .cpp file:
#include <opencv2/opencv.hpp>
The console show me this result:
12:24:25 **** Build of configuration Default for project ProvaVideoCapture ****
"C:\\Users\\Micaela\\Desktop\\Android\\android-ndk-r8e\\ndk-build.cmd" all
"Compile++ thumb : jniVideoCapture <= jniVideoCapture.cpp
jni/jniVideoCapture.cpp:4:30: fatal error: opencv2/opencv.hpp: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi-v7a/objs/jniVideoCapture/jniVideoCapture.o] Error 1
12:24:26 Build Finished (took 282ms)
My Android.mk file is:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jniVideoCapture
LOCAL_SRC_FILES := jniVideoCapture.cpp
include $(BUILD_SHARED_LIBRARY)
The Application.mk file that I've added manually (it has not been automatically added by Eclipse) is:
APP_ABI := all
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_PLATFORM := android-9
I don't know how to solve this problem, or what I've done wrong.
Could you help me?
Add path like below to your Android.mk file and check
include E:/OpenCV-2.3.1/share/OpenCV/OpenCV.mk
Sample Android.mk for reference
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_LIB_TYPE:=STATIC
OPENCV_INSTALL_MODULES:=on
include E:/OpenCV-2.3.1/share/OpenCV/OpenCV.mk
include $(OPENCV_MK_PATH)
LOCAL_MODULE := firstcv
LOCAL_SRC_FILES := first.cpp
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
I am attempting to compile an Android-9 project that calls Android NDK functions (such as "AAsset_close") by running "ndk-build" via the Cygwin terminal, but the "ndk-build" command returns an error message, stating that it is unable to find the function definitions.
The error messages from "ndk-build" are as follows:
[Android NDK path]/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: [project folder]/static library: in function [function name]:[file name]:39: error: undefined reference to 'AAsset_close'
etc.
My "Android.mk" file is as follows:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := <name of project>
LOCAL_C_INCLUDES := <folders where header files are located>
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O2 -Wall -D__ANDROID__ -DtyANDROID
LOCAL_CPPFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O2 -Wall -D__ANDROID__ -DtyANDROID
LOCAL_LDLIBS := -lm -lEGL -lGLESv2 -llog -lz -landroid
LOCAL_STATIC_LIBRARIES := android_native_app_glue
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := <source files>
include $(BUILD_STATIC_LIBRARY)
...
My "Application.mk" makefile is as follows:
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-9
According to the "nm" Unix command, this function is defined within the Android NDK library "libandroid.so", which is present in the NDK path for all target platforms. As demonstrated above, I have included "-landroid" to the "LOCAL_LDLIBS" macro, which should allow me to link against that library. What else do I need to do to fix this compile error?
You show the Android.mk that builds a static library, at this step the linker is not called, threfore $(LOCAL_LDLIBS) is ignored. You probably have another Android.mk or a different section, where you have
include $(BUILD_SHARED_LIBRARY)
Please check, -landroid is probably missing in that section.