puerts icon indicating copy to clipboard operation
puerts copied to clipboard

[unity]android总是崩溃,使用的版本是1.4, 堆栈显示是libpuerts.so,请问有symbols可以提供吗?

Open kefeibuhuifei opened this issue 2 years ago • 4 comments

我android总是崩溃,使用的版本是1.4, 堆栈显示是libpuerts.so,请问有symbols可以提供吗?

kefeibuhuifei avatar May 26 '23 09:05 kefeibuhuifei

https://puerts.github.io/docs/puerts/unity/other/building 可以参考这个文档自行编译,切换1.4分支并将此处: https://github.com/Tencent/puerts/blob/unity-1.4.x/unity/native_src/CMakeLists.txt#L163 的strip命令去掉

zombieyang avatar May 26 '23 09:05 zombieyang

1.4里只有make.mts 所以我使用下面方式 PS E:\puerts-unity-1.4.x\unity\native_src> npx tsx make.mts --backend v8_9.4 --platform android 出错了 CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/CMakeDetermineSystem.cmake:154 (message): Could not find toolchain file: ~/android-ndk-r21b/build/cmake/android.toolchain.cmake Call Stack (most recent call first): CMakeLists.txt:10 (project)

-- Configuring incomplete, errors occurred! e:\puerts-unity-1.4.x\unity\native_src\make.mts:34 assert.equal(0, exec(cmake ${cmakeDArgs} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DJS_ENGINE=${options.backend} -DCMAKE_BUILD_TYPE=${options.config} -DANDROID_ABI=${ABI} -H. -B${CMAKE_BUILD_PATH} -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=${API} -DANDROID_TOOLCHAIN=clang -DANDROID_TOOLCHAIN_NAME=${TOOLCHAIN_NAME}).code) ^

AssertionError [ERR_ASSERTION]: 0 == 1 at Object.hook (e:\puerts-unity-1.4.x\unity\native_src\make.mts:34:24) at null.runPuertsMake (e:\puerts-unity-1.4.x\unity\native_src\make.mts:188:34) at null. (e:\puerts-unity-1.4.x\unity\native_src\make.mts:304:17) { generatedMessage: true, code: 'ERR_ASSERTION', actual: 0, expected: 1, operator: '==' }

kefeibuhuifei avatar May 28 '23 04:05 kefeibuhuifei

文档的意思是你可以查看github action文件来得知正确的编译命令 https://github.com/Tencent/puerts/blob/unity-1.4.x/.github/workflows/composites/unity-build-plugins/android/action.yml#LL38C40-L38C66

你报的错误因为NDK没下载下来

zombieyang avatar May 29 '23 09:05 zombieyang

后续可以考虑升级2.0.

2.0后的版本在github action上自带stripped之前的so https://github.com/Tencent/puerts/actions/runs/5088577010

zombieyang avatar May 29 '23 09:05 zombieyang