3.6 Android NDK
Refer
to ndk.
Run <sdk_root>/tools/android
to update
app project file. Then under JNI subfolder run <ndk_root>/ndk-build
to build
native code. If build directly from Eclipse, use mouse right click
Project=>Android Tools=>Add native Support, might see many not
resolved error as Eclipse might not use the right include path. Also,
Eclipse will auto delete all .so files under libs(jar files is ok)
when building NDK code. So if have other prebuilt .so files, don't
put them under libs. Either put them somewhere else, or follow this
SO
to treat as prebuilt. Refer Ndk
guide for using prebuilt librarries. Refer to this SO
and JNI
tip for calling Java from native code. Eclipse ADK might have
problem with NDK: it can build, but report Semantic Error with
Method/Symbol could not be resolved. Refer to Android
NDK build, Method could not be resolved
and Eclipse
compiles successfully but still gives semantic errors as
it might be a bug with Eclipse plugin. For me, restart Eclipse may be
ok.
Regarding
armeabi/armeabi-v7a, refer to ABIs
and application_mk
guide. APP_ABI
:= armeabi armeabi-v7a x86 mips
can only be set in Application.mk.
By default, add NDK support from Eclipse ADT doesn't create this
Application.mk.
So if needs to generate other than the default armeabi binary, will
need to add a Application.mk
with the APP_ABI
line. Use TARGET_ARCH_ABI
in Android.mk
won't do it.
Get
Android
NDK: WARNING: APP_PLATFORM android-16 is larger than
android:minSdkVersion 14 in ./AndroidManifest.xml:
Refer to this SO;
need to add APP_PLATFORM
:= android-14
in jni/Application.mk,
otherwise the setting is taken from project.properties
file, which is the setting of compileSdkVersion.
Below
is Android.mk
and
Application.mk
for NagaSoft vjplayer prebuilt libs(armeabi-v7a only):
#Android.mk
LOCAL_PATH
:= $(call my-dir)
include
$(CLEAR_VARS)
LOCAL_MODULE
:= vjplayer
LOCAL_SRC_FILES
:= libvjplayer_jni.so
include
$(PREBUILT_SHARED_LIBRARY)
include
$(CLEAR_VARS)
LOCAL_MODULE
:= p2pcore
LOCAL_SRC_FILES
:= libp2pcore.so
include
$(PREBUILT_SHARED_LIBRARY)
#Application.mk
APP_ABI
:= armeabi-v7a
APP_PLATFORM
:= android-14
Problem
with NDK r13:
this NDK toolchain mostly are 4.9, but when I use this NDK to build
OpenSSL-Vitamio, it always looks for 4.8 toolchain. The NDK
CHANGELOG.MD
mentioned
`NDK_TOOLCHAIN_VERSION`
now defaults to Clang.
So I have to do build like:
ndk-build
NDK_TOOLCHAIN_VERSION=4.9.
Get problem fox
x86_64:
BN_ULONG
redefined. As
mentioned in check-all-builds.sh:
The
$HOST_OS-x86_64
is currently broken because the single <openssl/opensslconf.h>
header is tailored for 32-bits. So
just build for arm v7a: ndk-build
NDK_TOOLCHAIN_VERSION=4.9 APP_ABI=armeabi-v7a
0 Comments:
Post a Comment