cocos creator1.9.0 安卓打包出错

编译模式:release
使用 Android Studio 工程:E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio
正在生成 apk 文件…
正在执行:’“E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\gradlew.bat” --parallel --info assembleRelease’

Initialized native services in: C:\Users\Administrator.gradle\native
Found daemon DaemonInfo{pid=8924, address=[234ecd41-e1d5-4f41-b7f5-865a3083873c port:64357, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1528370751589, context=DefaultDaemonContext[uid=72519f9c-7ae2-4ff9-9975-149c7d4697fe,javaHome=C:\Program Files\Java\jdk1.8.0_171,daemonRegistryDir=C:\Users\Administrator.gradle\daemon,pid=8924,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=D:\java,daemonRegistryDir=C:\Users\Administrator.gradle\daemon,pid=7216,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=72519f9c-7ae2-4ff9-9975-149c7d4697fe,javaHome=C:\Program Files\Java\jdk1.8.0_171,daemonRegistryDir=C:\Users\Administrator.gradle\daemon,pid=8924,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

Looking for a different daemon…
The client will now receive all logging from the daemon (pid: 4460). The daemon log file: C:\Users\Administrator.gradle\daemon\4.1\daemon-4460.out.log
Starting 4th build in daemon [uptime: 16 mins 4.374 secs, performance: 100%, no major garbage collections]
Using 4 worker leases.
Creating new cache for fileHashes, path E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio.gradle\4.1\fileHashes\fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@4fb51649
Creating new cache for plugin-use-metadata, path C:\Users\Administrator.gradle\caches\4.1\plugin-resolution\plugin-use-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@1ec73a8c
Creating new cache for client-status, path C:\Users\Administrator.gradle\caches\4.1\plugin-resolution\client-status.bin, access org.gradle.cache.internal.DefaultCacheAccess@1ec73a8c
Starting Build
Settings evaluated using settings file ‘E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\settings.gradle’.
Projects loaded. Root project using build file ‘E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\build.gradle’.
Included projects: [root project ‘proj.android-studio’, project ‘:implementation’, project ‘:libcocos2dx’]
Parallel execution is an incubating feature.
Evaluating root project ‘proj.android-studio’ using build file ‘E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\build.gradle’.
Creating new cache for metadata-1.1/results, path C:\Users\Administrator.gradle\caches\transforms-1\metadata-1.1\results.bin, access org.gradle.cache.internal.DefaultCacheAccess@7d2ea52c
Creating new cache for metadata-2.23/module-metadata, path C:\Users\Administrator.gradle\caches\modules-2\metadata-2.23\module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@5e656783
Creating new cache for metadata-2.23/artifact-at-repository, path C:\Users\Administrator.gradle\caches\modules-2\metadata-2.23\artifact-at-repository.bin, access org.gradle.cache.internal.DefaultCacheAccess@5e656783
Evaluating project ‘:implementation’ using build file ‘E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\build.gradle’.
Creating configuration androidTestUtil
Creating configuration compile
Creating configuration apk
Creating configuration provided
Creating configuration api
Creating configuration implementation
Creating configuration runtimeOnly
Creating configuration compileOnly
Creating configuration wearApp
Creating configuration annotationProcessor
Creating configuration androidTestCompile
Creating configuration androidTestApk
Creating configuration androidTestProvided
Creating configuration androidTestApi
Creating configuration androidTestImplementation
Creating configuration androidTestRuntimeOnly
Creating configuration androidTestCompileOnly
Creating configuration androidTestWearApp
Creating configuration androidTestAnnotationProcessor
Creating configuration testCompile
Creating configuration testApk
Creating configuration testProvided
Creating configuration testApi
Creating configuration testImplementation
Creating configuration testRuntimeOnly
Creating configuration testCompileOnly
Creating configuration testWearApp
Creating configuration testAnnotationProcessor
Creating configuration debugCompile
Creating configuration debugApk
Creating configuration debugProvided
Creating configuration debugApi
Creating configuration debugImplementation
Creating configuration debugRuntimeOnly
Creating configuration debugCompileOnly
Creating configuration debugWearApp
Creating configuration debugAnnotationProcessor
Creating configuration androidTestDebugCompile
Creating configuration androidTestDebugApk
Creating configuration androidTestDebugProvided
Creating configuration androidTestDebugApi
Creating configuration androidTestDebugImplementation
Creating configuration androidTestDebugRuntimeOnly
Creating configuration androidTestDebugCompileOnly
Creating configuration androidTestDebugWearApp
Creating configuration androidTestDebugAnnotationProcessor
Creating configuration testDebugCompile
Creating configuration testDebugApk
Creating configuration testDebugProvided
Creating configuration testDebugApi
Creating configuration testDebugImplementation
Creating configuration testDebugRuntimeOnly
Creating configuration testDebugCompileOnly
Creating configuration testDebugWearApp
Creating configuration testDebugAnnotationProcessor
Creating configuration releaseCompile
Creating configuration releaseApk
Creating configuration releaseProvided
Creating configuration releaseApi
Creating configuration releaseImplementation
Creating configuration releaseRuntimeOnly
Creating configuration releaseCompileOnly
Creating configuration releaseWearApp
Creating configuration releaseAnnotationProcessor
Creating configuration testReleaseCompile
Creating configuration testReleaseApk
Creating configuration testReleaseProvided
Creating configuration testReleaseApi
Creating configuration testReleaseImplementation
Creating configuration testReleaseRuntimeOnly
Creating configuration testReleaseCompileOnly
Creating configuration testReleaseWearApp
Creating configuration testReleaseAnnotationProcessor
Configuration ‘compile’ in project ‘:implementation’ is deprecated. Use ‘implementation’ instead.
Parsing the SDK, no caching allowed
SDK initialized in 6 ms

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:implementation’.

ABIs [armeabi] are not supported for platform. Supported ABIs are [armeabi-v7a, arm64-v8a, x86, x86_64].

  • 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 1s
执行命令出错,返回值:1。


这是构建面板的配置,大佬们给点思路

我以前也遇到过类似的问题,你把ABI 全部取消勾选试试

你的时怎么处理掉的,我把ABI去掉之后还是报错。下面是报错log:

  • What went wrong:
    Execution failed for task ‘:implementation:externalNativeBuildRelease’.

Build command failed.
Error while executing process D:\anzhuang\android_SDK\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=E:\01-cocos-projects\microGameClient\build\jsb-default\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=E:/01-cocos-projects/microGameClient/build/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-10 NDK_MODULE_PATH=E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\cocos2d-x;E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\cocos2d-x\cocos;E:\01-cocos-projects\microGameClient\build\jsb-default\frameworks\cocos2d-x\external -j4 NDK_DEBUG=0 E:/01-cocos-projects/microGameClient/build/jsb-default/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.
Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information.
Android NDK: WARNING: Deprecated NDK_TOOLCHAIN_VERSION value: 4.9. GCC is no longer supported and will be removed in the next release. See https://android.googlesource.com/platform/ndk/+/master/docs/ClangMigration.md.
[armeabi-v7a] Compile++ arm : cocos2djs_shared <= AppDelegate.cpp
[armeabi-v7a] Compile++ arm : cocos2djs_shared <= jsb_module_register.cpp
[armeabi-v7a] SharedLibrary : libcocos2djs.so
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCParticleSystem.cpp:597: error: undefined reference to ‘rand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:647: error: undefined reference to ‘atof’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:653: error: undefined reference to ‘atof’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:696: error: undefined reference to ‘atof’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCTMXXMLParser.cpp:690: error: undefined reference to ‘atof’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.cpp:1220: error: undefined reference to ‘srand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.cpp:1221: error: undefined reference to ‘rand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.cpp:1249: error: undefined reference to ‘srand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/base/CCConsole.cpp:1250: error: undefined reference to ‘rand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/base/ccRandom.h:117: error: undefined reference to ‘rand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:280: error: undefined reference to ‘srand’
/Users/lanhaozhi/steven/git/microGameClient/build/jsb-default/frameworks/cocos2d-x/cocos/2d/CCActionTiledGrid.cpp:606: error: undefined reference to ‘srand’
collect2.exe: error: ld returned 1 exit status
make: *** [E:/01-cocos-projects/microGameClient/build/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcocos2djs.so] Error 1

我咋感觉是你NDK有问题呢,首先确定ndk的配置是否正确,ndk版本是多少?

ndk是最新的,好像是17的

我也碰到了,请问你解决了吗

这个是APP ABI的问题,armeabi这个是兼容较低版本的。去掉这个看看效果把

APP ABI全去掉了 API Level也改成了android-19 但是还是会报错 应该是ndk版本问题 但不知道怎么解决…
/Users/leon/Library/Android/sdk/ndk-bundle/build/core/setup-toolchain.mk:52: *** Android NDK: Invalid NDK_TOOLCHAIN_VERSION value: 4.9. GCC is no longer supported. See https://android.googlesource.com/