[Huawei Developers] John Wo:
Some problems may occur when the APM SDK is integrated into a Cocos-based app and during app release. This article summarizes some common problems and talks about how to deal with them.

1. Problem: Error message "[NDK Root] is empty, please set [NDK Root] in Preferences." is displayed when you build an Android project for the first time, indicating that the NDK is unavailable.

Cause: The Android NDK and Android SDK paths are not configured when the project is built.

Solution: Go to File > Settings... in Cocos Creator, click the Native Develop tab page, and set Android SDK Root and NDK Root.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027092944.54687377240341255317696010067064:50511109060448:2800:92231318372FF24EFC8E4536727F74E42B93B4001964CA89F9756F50114E6CD9.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027092944.54687377240341255317696010067064:50511109060448:2800:92231318372FF24EFC8E4536727F74E42B93B4001964CA89F9756F50114E6CD9.jpg[/IMG]

You can obtain the required Android SDK and NDK paths from Android Studio, as shown in the following figures.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093355.90642446887972119155669671807457:50511109060448:2800:430A1D534D577F95177AC0CEDEFFAE3E73B16ADCF0394C55CDBCFA1F1104B34F.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093355.90642446887972119155669671807457:50511109060448:2800:430A1D534D577F95177AC0CEDEFFAE3E73B16ADCF0394C55CDBCFA1F1104B34F.jpg[/IMG]

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027094729.05520224726900877490872432600182:50511109060448:2800:B6083C0BE0C1D83A9B21CEE3A6CFA1D0DA68B34663E0B26E0821778BCC4C696E.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027094729.05520224726900877490872432600182:50511109060448:2800:B6083C0BE0C1D83A9B21CEE3A6CFA1D0DA68B34663E0B26E0821778BCC4C696E.jpg[/IMG]

Copy and paste the preceding paths to Cocos Creator, and go back to the Build... page for further operations.

Note: In some cases, a default NDK path may not exist. You can download the NDK here in Android Studio.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093429.82966252459997445751528935235391:50511109060448:2800:00C50A7D2D2A6A95B87421B1649F9F266C8D20FA4F5DAAFD3843BD418B6B1D33.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093429.82966252459997445751528935235391:50511109060448:2800:00C50A7D2D2A6A95B87421B1649F9F266C8D20FA4F5DAAFD3843BD418B6B1D33.jpg[/IMG]

2. Problem: Error message "TypeError: Cannot read property 'xxx' of undefined." is displayed.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093509.09357006136658738476023503741027:50511109060448:2800:5829F002DF6DC91803ACA4D4BE48DEAF35AF78116E44C52AA308EFBEA8FEF361.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093509.09357006136658738476023503741027:50511109060448:2800:5829F002DF6DC91803ACA4D4BE48DEAF35AF78116E44C52AA308EFBEA8FEF361.jpg[/IMG]

Cause: A script with the same name exists on the computer. This problem may occur regardless of whether the scripts of the same name are in the same folder.

Solution: Ensure that each script has a unique name by renaming or deleting scripts.

3. Problem: Error message "Task:game:externalNativeBuildReleaseFeature" is displayed during compilation, but the building process is normal.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093527.84677756875796584904713951804968:50511109060448:2800:FBD687D8A23254C30A6FAEA930E8CD710969100A38F90FD5BBC16FAF05F31C68.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027093527.84677756875796584904713951804968:50511109060448:2800:FBD687D8A23254C30A6FAEA930E8CD710969100A38F90FD5BBC16FAF05F31C68.jpg[/IMG]

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027094807.58804958427785859626145708301250:50511109060448:2800:164E89CF0ECD5A060E5B6458E5AF335884AACDD121B27E5A467753D3AB442D6E.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/006/560/358/2640852000006560358.20201027094807.58804958427785859626145708301250:50511109060448:2800:164E89CF0ECD5A060E5B6458E5AF335884AACDD121B27E5A467753D3AB442D6E.jpg[/IMG]

Cause: The path contains special characters or is too long.

Solution: Place the project folder in the root directory and ensure that the project file name does not contain special characters. Then delete the build folder and try again.