windows下eclipseNDK开发兼调试环境配置

windows下eclipseNDK开发兼调试环境配置

NDK-r7版本及之后windows下开发NDK开发更加方便。

PS:该环境并没有配置CDT、cygwin、Mingw,因为现在的adt已经有c/c++开发的相关配置了,而ndk又集成了linux的编译环境,装太多东西不保证能成功。

原文链接:http://my.oschina.net/u/262922/blog/301513

配置流程如下:

image_mark

新建一个android工程,等下也不要转为c/c++工程

image_mark

image_mark

image_mark

image_mark

image_mark

以下根据具体情况去设置下Application.mk:

以下根据具体情况去设置下

Application.mk:

1
2
3
4
5
6
7
8
9
10
11
APP_STL := gnustl_static
APP_CFLAGS += -fexceptions
APP_CPPFLAGS +=-std=c++11
APP_CPPFLAGS +=-fpermissive
APP_OPTIM := debug
APP_PLATFORM := android-8

Android.mk:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#APP_STL := gnustl_static
LOCAL_MODULE := WebService
LOCAL_SRC_FILES := com_http_WebService.cpp \
MessageProxy.cpp \
MsgBase.cpp \
NetQueue.cpp \
SendOperation.cpp \
ThreadControl.cpp
LOCAL_STATIC_LIBRARIES := stdc++
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_LDLIBS := -L$(LOCAL_PATH)/lib -lcurl
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)

Manifest.xml中application可能要加入才能调试:

android:debuggable=”true”

如果要从Android调试到C/C++代码,需要再MainActivity.java的onCreate中加入

android.os.Debug.waitForDebugger();

然后右键—>Debug As—>Android Native Application开始调试

Comments