From 47e7d1baeae365a9e503d7790fdde7a800f5e5be Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Tue, 25 May 2021 18:54:00 +0200 Subject: [PATCH] Update Android info --- examples/others/android/example/README.md | 12 +++++++----- raylib/utils_android.c | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/others/android/example/README.md b/examples/others/android/example/README.md index 67448ca..9a15651 100644 --- a/examples/others/android/example/README.md +++ b/examples/others/android/example/README.md @@ -11,15 +11,17 @@ Add toolchain bin directory to PATH: export PATH=${ANDROID_NDK_HOME}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:${PATH} -Export sysroot path: +Export sysroot and libdirs: - export ANDROID_SYSROOT=${ANDROID_NDK_HOME}/platforms/android-16/arch-arm + export ANDROID_SYSROOT=${ANDROID_NDK_HOME}/sysroot + export ANDROID_PLATFORM=${ANDROID_NDK_HOME}/platforms/android-16/arch-arm + export ANDROID_TOOLCHAIN=${ANDROID_NDK_HOME}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 And compile shared library: - CC=arm-linux-androideabi-gcc \ - CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include --sysroot=${ANDROID_SYSROOT} -D__ANDROID_API__=16" \ - CGO_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib --sysroot=${ANDROID_SYSROOT}" \ + CC="arm-linux-androideabi-gcc" \ + CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include -I${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi --sysroot=${ANDROID_SYSROOT} -D__ANDROID_API__=16" \ + CGO_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib/arm-linux-androideabi -L${ANDROID_PLATFORM}/usr/lib -L${ANDROID_TOOLCHAIN}/arm-linux-androideabi/lib -L${ANDROID_TOOLCHAIN}/lib/gcc/arm-linux-androideabi/4.9.x --sysroot=${ANDROID_PLATFORM}" \ CGO_ENABLED=1 GOOS=android GOARCH=arm \ go build -buildmode=c-shared -ldflags="-s -w -extldflags=-Wl,-soname,libexample.so" \ -o=android/libs/armeabi-v7a/libexample.so diff --git a/raylib/utils_android.c b/raylib/utils_android.c index 9f290f2..2b80116 100644 --- a/raylib/utils_android.c +++ b/raylib/utils_android.c @@ -4,19 +4,19 @@ #include void log_info(const char *msg) { - __android_log_print(ANDROID_LOG_INFO, "raylib", msg); + __android_log_print(ANDROID_LOG_INFO, "raylib", "%s\n", msg); } void log_warn(const char *msg) { - __android_log_print(ANDROID_LOG_WARN, "raylib", msg); + __android_log_print(ANDROID_LOG_WARN, "raylib", "%s\n", msg); } void log_error(const char *msg) { - __android_log_print(ANDROID_LOG_ERROR, "raylib", msg); + __android_log_print(ANDROID_LOG_ERROR, "raylib", "%s\n", msg); } void log_debug(const char *msg) { - __android_log_print(ANDROID_LOG_DEBUG, "raylib", msg); + __android_log_print(ANDROID_LOG_DEBUG, "raylib", "%s\n", msg); } const char* get_internal_storage_path() {