From 6a91a9ad8ac9d3df4b62e84f70cd19ea19b53d15 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 14 Feb 2018 17:10:57 +0900 Subject: [PATCH] Build libsimplejni using SDK The lib hasn't been built using SDK and thus has been causing link-type check warning from SimpleJNI which is built using SDK. Since the warning will turn into error soon, fixing the warning by correctly building the lib with SDK. Bug: 69899800 Test: m -j SimpleJNI is successful and does not show any link-type check warning Change-Id: I51edfe296c70ac99ac7698b5e06ec0e0c678945c --- samples/SimpleJNI/jni/Android.mk | 11 ++++------- samples/SimpleJNI/jni/native.cpp | 8 +++++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/samples/SimpleJNI/jni/Android.mk b/samples/SimpleJNI/jni/Android.mk index 1c2589fbf..dc6390f01 100644 --- a/samples/SimpleJNI/jni/Android.mk +++ b/samples/SimpleJNI/jni/Android.mk @@ -31,18 +31,15 @@ LOCAL_SRC_FILES:= \ native.cpp # All of the shared libraries we link against. -LOCAL_SHARED_LIBRARIES := \ - liblog +LOCAL_LDLIBS := -llog # No static libraries. LOCAL_STATIC_LIBRARIES := -# Also need the JNI headers. -LOCAL_C_INCLUDES += \ - $(JNI_H_INCLUDE) - LOCAL_CFLAGS := -Wall -Werror -LOCAL_CXX_STL := none +LOCAL_NDK_STL_VARIANT := none + +LOCAL_SDK_VERSION := current include $(BUILD_SHARED_LIBRARY) diff --git a/samples/SimpleJNI/jni/native.cpp b/samples/SimpleJNI/jni/native.cpp index dd322c4f8..cb52233f2 100644 --- a/samples/SimpleJNI/jni/native.cpp +++ b/samples/SimpleJNI/jni/native.cpp @@ -15,12 +15,18 @@ */ #define LOG_TAG "simplejni native.cpp" -#include +#include #include #include "jni.h" +#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) +#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) +#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) +#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) +#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) + static jint add(JNIEnv* /*env*/, jobject /*thiz*/, jint a, jint b) { int result = a + b;