I not too long ago migrated from Unity to Cocos Creator and utilizing Cocos 3.5.0. So, my experiences in Cocos Creator is sort of a new child child. The lovable one.
So, then I’ve an issue when attempting to construct .APK file utilizing Android Studio. It someway throw me this error:
Construct command failed.
Error whereas executing course of D:_devandroidcmake3.10.2.4988404binninja.exe with arguments {-C D:minkymomo2022github_repomain_refactor_0904trunkbuildandroid-001projbuildcmakedebugx86 cocos}
ninja: Getting into listing `D:minkymomo2022github_repomain_refactor_0904trunkbuildandroid-001projbuildcmakedebugx86'
[1/1] Linking CXX shared library D:minkymomo2022github_repomain_refactor_0904trunkbuildandroid-001projbuildMuscleManintermediatescmakedebugobjx86libcocos.so
FAILED: D:/minkymomo/2022/github_repo/main_refactor_0904/trunk/construct/android-001/proj/construct/MuscleMan/intermediates/cmake/debug/obj/x86/libcocos.so
cmd.exe /C "cd . && D:_devandroidndk25.0.8775105toolchainsllvmprebuiltwindows-x86_64binclang++.exe --target=i686-none-linux-android21 --sysroot=D:/_dev/android/ndk/25.0.8775105/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions -fsigned-char -fno-limit-debug-info -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libcocos.so -o D:minkymomo2022github_repomain_refactor_0904trunkbuildandroid-001projbuildMuscleManintermediatescmakedebugobjx86libcocos.so @CMakeFiles/cocos.rsp && cd ."
ld: error: undefined hidden image: __stack_chk_fail_local
>>> referenced by uv-common.o:(uv__unknown_err_code) in archive D:/CocosDashboard/assets/.editors/Creator/3.5.0/assets/assets/3d/engine/native/exterior/cmake/../android/x86/libuv.a
>>> referenced by uv-common.o:(uv_ip6_addr) in archive D:/CocosDashboard/assets/.editors/Creator/3.5.0/assets/assets/3d/engine/native/exterior/cmake/../android/x86/libuv.a
>>> referenced by inet.o:(inet_ntop4) in archive D:/CocosDashboard/assets/.editors/Creator/3.5.0/assets/assets/3d/engine/native/exterior/cmake/../android/x86/libuv.a
>>> referenced 26 extra instances
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: construct stopped: subcommand failed.
Beneath is the construct.gradle from libcocos:essential
android {
ndkPath PROP_NDK_PATH
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() // 33
defaultConfig {
minSdkVersion PROP_MIN_SDK_VERSION //21
targetSdkVersion PROP_TARGET_SDK_VERSION //33
versionCode 1
versionName "1.0"
}
However, once I run Debug, the debug.apk
was efficiently made and it’s runnable on the gadgets.
I’m utilizing Android Studio Chipmunk.
Anybody else having the identical challenge? Is there any repair/workaround for this?
I simply came upon that it solely occur once I decide to make use of x86 and x86_64 within the construct setting in Cocos.
After I eliminated each, the .APK compiled efficiently. Why?
google might need eliminated x86 from the most recent ndk model, attempt altering the ndk to a decrease model eg: model 21.1.6352462 works with x86. It may be modified in cocos creator → preferences → exterior applications → android ndk after which make a construct with APP ABI x86 chosen it ought to work positive.
P.S. you will have to obtain the decrease ndk model first