07 CoCos Creator libcocos2dx verifyReleaseResources FAILED

1. 现象

libcocos2dx:verifyReleaseResources FAILED

:libcocos2dx:verifyReleaseResources FAILED
:libcocos2dx:verifyReleaseResources (Thread[Daemon worker,5,main]) completed. Took 0.187 secs.
Android NDK: android-10 is unsupported. Using minimum supported version android-14.    
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= AppDelegate.cpp
[armeabi-v7a] Compile++ arm  : cocos2djs_shared <= jsb_module_register.cpp
[armeabi-v7a] SharedLibrary  : libcocos2djs.so

C
:/CocosCreator/resources/cocos2d-x/cocos/2d/CCParticleSystem.cpp:597: error: undefined reference to 'rand'
C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:696: error: undefined reference to 'atof'
C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:690: error: undefined reference to 'atof'
C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:653: error: undefined reference to 'atof'
C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:647: error: undefined reference to 'atof'
C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1220: error: undefined reference to 'srand'
C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1221: error: undefined reference to 'rand'
C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1249: error: undefined reference to 'srand'
C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1250: error: undefined reference to 'rand'
C:/CocosCreator/resources/cocos2d-x/cocos/base/ccRandom.h:117: error: undefined reference to 'rand'
C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:280: error: undefined reference to 'srand'
C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:606: error: undefined reference to 'srand

C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:606: error: undefined reference to 'srand
'
collect2.exe: error: ld returned 1 exit status
make: *** [D:/CoCosCreator/HelloWorld/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so] Error 1
:hello_world:externalNativeBuildRelease FAILED
:hello_world:externalNativeBuildRelease (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 23.337 secs.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':libcocos2dx:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':hello_world:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process D:\android-ndk-r16b-windows-x86_64\android-ndk-r16b\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=D:\CoCosCreator\HelloWorld\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=D:\CoCosCreator\HelloWorld\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-14 NDK_OUT=D:/CoCosCreator/HelloWorld/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=D:\CoCosCreator\HelloWorld\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-10 NDK_MODULE_PATH=C:\CocosCreator\resources\cocos2d-x;C:\CocosCreator\resources\cocos2d-x\cocos;C:\CocosCreator\resources\cocos2d-x\external -j4 NDK_DEBUG=0 D:/CoCosCreator/HelloWorld/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so}
  Android NDK: android-10 is unsupported. Using minimum supported version android-14.    
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= AppDelegate.cpp
  [armeabi-v7a] Compile++ arm  : cocos2djs_shared <= jsb_module_register.cpp
  [armeabi-v7a] SharedLibrary  : libcocos2djs.so
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCParticleSystem.cpp:597: error: undefined reference to 'rand'
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:696: error: undefined reference to 'atof'
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:690: error: undefined reference to 'atof'
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:653: error: undefined reference to 'atof'
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:647: error: undefined reference to 'atof'
  C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1220: error: undefined reference to 'srand'
  C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1221: error: undefined reference to 'rand'
  C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1249: error: undefined reference to 'srand'
  C:/CocosCreator/resources/cocos2d-x/cocos/base/CCConsole.cpp:1250: error: undefined reference to 'rand'
  C:/CocosCreator/resources/cocos2d-x/cocos/base/ccRandom.h:117: error: undefined reference to 'rand'
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:280: error: undefined reference to 'srand'
  C:/CocosCreator/resources/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:606: error: undefined reference to 'srand'
  collect2.exe: error: ld returned 1 exit status
  make: *** [D:/CoCosCreator/HelloWorld/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so] Error 1


* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 42s
43 actionable tasks: 2 executed, 41 up-to-date
执行命令出错,返回值:1。

2. 解决方案

2.1 网上通用解决方案

But if you are facing issues with it, you can switch back to previous version by adding this in gradle.properties

android.enableAapt2=false

例如

  • D:\CoCosCreator\HelloWorld\build\jsb-link\frameworks\runtime-src\proj.android-studio\gradle.properties
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

PROP_TARGET_SDK_VERSION=22
PROP_APP_ABI=armeabi-v7a

RELEASE_STORE_FILE=C:/CocosCreator/resources/static/build-templates/native/debug.keystore
RELEASE_STORE_PASSWORD=123456
RELEASE_KEY_ALIAS=debug_keystore
RELEASE_KEY_PASSWORD=123456

android.enableAapt2=false

2.2 缺少符点库

上述少了浮点库,且需要确保ndk版本在16

ndk版本

2.3 选armv7,兼容模式

07 CoCos Creator libcocos2dx verifyReleaseResources FAILED_第1张图片

你可能感兴趣的:(CoCos,Creator,libcocos2dx,cocos,creator)