• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SDK Usage
2
3## What is the macro definition of the arm64-v8a/armeabi-v7a directory in CMake?
4
5Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
6
7**Solution**
8
9The **arm64-v8a** and **armeabi-v7a** directories are as follows:
10
11```
12entry
13├─ libs
14│    ├─ arm64-v8a
15│    │    └─ libMyDemo.so
16│    └─ armeabi-v7a
17│         └─ libMyDemo.so
18└─ src
19     └─ main
20          └─ cpp
21               └─ CMakeLists.txt
22```
23
24The macro for accessing the directory is **\$\{CMAKE\_CURRENT\_SOURCE\_DIR\}/../../../libs/$\{OHOS\_ARCH\}/xxxx.so**.
25
26**CMAKE\_CURRENT\_SOURCE\_DIR**: directory where the **CMakeList.txt** file is stored.
27
28**OHOS\_ARCH**: type of the application binary interface (ABI). The value can be **armeabi-v7a** or **arm64-v8a**. The default value is **arm64-v8a**.
29
30**Example**
31
32Add the link library to **CMakeLists.txt**.
33
34```
35target_link_libraries(entry PUBLIC
36    libace_napi.z.so
37    libhilog_ndk.z.so
38    ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMyDemo.so
39)
40```
41
42## What should I do if an error is reported when OH\_LOG\_Print in the native code is used to print logs?
43
44Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
45
46**Problem**
47
48When **OH\_LOG\_Print** is used in the native code to print logs, the following error is reported: **undefined symbol: OH\_LOG\_Print**.
49
50**Cause**
51
52The link library file is missing.
53
54**Solution**
55
56Open the **CMakeLists.txt** file and append **libhilog\_ndk.z.so** to **target\_link\_libraries**.
57
58```
59set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
60target_link_libraries(entry PUBLIC
61    libace_napi.z.so
62    libhilog_ndk.z.so
63)
64```
65
66## How do I traverse files in rawfile?
67
68Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
69
70**Solution**
71
72Use the **OH\_ResourceManager\_OpenRawDir\(\)** native API to obtain the root directory of **rawfile** and traverse the root directory.
73
74**Reference**
75
76[Rawfile](../reference/native-apis/rawfile.md)