Android NDK AS main simulation inlet

StudyCpp new packet, then the introduction of all files in the package studyCpp CMakeLists.txt as follows:
Here Insert Picture Description

file(GLOB sourceFiles studyCpp/*.h studyCpp/*.cpp studyCpp/*.c)
#file(GLOB sourceFiles logCpp/*.h logCpp/*.cpp logCpp/*.c)

add_library( # Sets the name of the library.
        native-lib

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        native-lib.cpp

        ${sourceFiles}

        )

Creating mylog.h for printing logs, as follows:

Here Insert Picture Description

// 使用NDK里面的日志库来打印  liblog.so
#include <android/log.h>

#define TAG "Hongx"

#define LOGD(...)__android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)

Creating main.h and main.cpp as follows:

Here Insert Picture Description

Here Insert Picture Description

LOGD("CCCCCCCCCCCCCCCCCCCCCCCCCCCCC");

Call mian () function in the native-lib.cpp as follows:
Here Insert Picture Description
Run to view the results:
Here Insert Picture Description

Published 446 original articles · won praise 67 · views 240 000 +

Guess you like

Origin blog.csdn.net/hongxue8888/article/details/105044927
Recommended