跳到主要內容

Cocos app 運行錯誤 [ERROR]: E/ ERROR: Uncaught TypeError: Error 6903, please go to.....EngineErrorMap.md#6903 to

 

打包 apk 測試遇到奇怪的問題, 

[ERROR]: E/ ERROR: Uncaught TypeError: Error 6903, please go to https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md#6903 to see details., location: src/cocos-js/cc.js:0:0


官網說這是資源加載有問題, 測試了確定不是加載不到, 是在後續流程使用clone出錯

public static createEffect(path: any, cb: any, parent: any) {
    this.loadRes("/gamePackages/effects/" + path, Prefab, function (err: any,
        prefab: any) {
        if (err) {
            cb('err', null);
            return;
        }

        //實際是這裡出錯
        var node = instantiate(prefab);
        if (!parent) {
            parent = find("Canvas");
        }

        parent.addChild(node);
        cb(null, node);
        });
    }


測試了發現instantiate(prefab) 有問題, prefab載入的並非是prefab資源

 public static loadRes(url: string, type: any, cb: Function = () => { }) {
        resources.load(url, (err: any, res: any) => {
            if (err) {
                error(err.message || err);
                cb(err, res);
                return;
            }

            cb && cb(null, res);
        })
    }

由於 BonusTime.Prefab 跟 BonusTime.anim 原本在同一個層級目錄所造成的, resources.load 加載到的是 animation 資源


後來把 
BonusTime.anim 改名成 BonusTimeaAim.anim 結果發現 animation.on("finished" 在動畫結束後調用沒有正常調用, 查看了下 animation 配置, 估計是因為修改了命名造成



代碼裡是這樣撥放的

let ani = node.getComponent(Animation);
ani.play('bonusTime');
ani.once(Animation.EventType.FINISHED, () => {
node && node.destroy();
callback(null);
 }, this);

後來把命名改回去, 拆分到不同目錄才解決問題


後來測試發現轉盤點Start會卡死, 看了看日誌也沒發現問題在哪

看了下代碼, 因為轉盤很單純的, 後來去排查老版本發現也有問題, 那就不是替換造成的了, 查了裡面的animation發現有missing, 把 animation.play 關閉後就好了





留言

這個網誌中的熱門文章

comfyUI 運行出錯 FATAL: kernel fmha_cutlassF_f32_aligned_64x64_rf_sm80 is for sm80-sm100, but was built for sm37

在公司的圖形機器上運行 ComfyUI + WAN 時出現下面問題   FATAL: kernel fmha_cutlassF_f32_aligned_64x64_rf_sm80 is for sm80-sm100, but was built for sm37 算圖機使用的 torch 版本如下 torch 2.7.1+cu118 torchaudio 2.7.1+cu118 torchsde 0.2.6 torchvision 0.22.1+cu118 檢查 cuda 版本 GeForce RTX 5090 CUDA Version: 13.0 從官網看 RTX 5090 支持 12.0 版本 CUDA 這是因爲本地的 pytorch 版本太舊 到官網查詢版本 https://pytorch.org/get-started/locally/ $ pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126 查詢目前版本 $ pip list | findstr torch 使用這個版本后出現下面問題 後面查詢 no kernel image 問題其實還是 pytorch 並不支持 sm_120( Blackwell架構) 查看后發現并沒有支持 sm_120 CUDA architectures : [' sm_37 ', 'sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_90', 'compute_37'] sm_50, sm_52, sm_53 : Maxwell (GTX 900 系列) sm_60, sm_61, sm_62 : Pascal (GTX 1000, P100) sm_70, sm_72, sm_75 : Volta/Turing (V100, RTX ...
仔細回想最近的作的 stripping level,還是回頭來說說 import dll 這回事吧;因為從事遊戲改版所以很多事情是言不由衷的,某天發現 server 發送給 client 封包是 big5 encode,第一時間覺得為何不用 unicode 呢?但仔細想也許是遊戲剛規劃時 DB 都已經存了 big5 編碼字串可能已經改不動了,想想也是就算了,結果一包到 android 就發生了 GetEncoding error,因為 android 是採用 unicode 編碼的,在網路上找了找終於找到解法,可以參考底下網址的討論串,主要是下載  I18N.dll、I18N.CJK.dll、I18N.West.dll 並丟到 Assets 資料夾下就可以了,當時還不是很了解為什麼只知道把 dll 都丟進去在手機上就可以跑,直到使用 stripping level 後整個又掛了,才認真去 trace, 問題在於勾選 strip asm 包檔後 I18N.CJK 就沒被包到 apk 裡面,而要解決 strip asm(~"~ 沒辦法 strip asm 很吸引我,一定要想辦法克服)採用了 link.xml 的方式,但這樣要怎麼知道弄進哪些 lib 呢?

熟悉 Unity Memory

    打開始跟 app memory 奮戰,摸索了好一陣子,不管是跑在 andorid 還是 Ios,之前做 WebPlayer 的經驗都派不上用場,也好在網路上資源很多,只要不恥繁找就能找到你所想要的,在此分享的主要是 android(ps. ~"~ 手頭上只有兩台 android 設備)。