Unity +Bugly 实现bug收集以及分析

应用场景:Android+IOS 客户端收集异常反馈数据,方便维护。

1:登陆Bugly官网,注册账号并“新建产品”,可以获取到一个“APP ID”,之后有用。



2:下载插件:https://bugly.qq.com/v2/downloads,并导入项目中,注意插件中并未包含IOS的相关插件

将:BuglyBridge/ios/BuglyBridge 文件夹拖到项目Plugins/IOS中,BuglySDK/IOS/Bugly.framework拖到

项目assest目录中


3:Unity中添加Bugly初始化代码:初始代码就这么简单,简单的添加一些测试代码

 private void initBugly()
    {
        BuglyAgent.ConfigDebugMode(true);
#if UNITY_IPHONE||UNITY_IOS
        BuglyAgent.InitWithAppId("你的APPID");
#elif UNITY_ANDROID
        BuglyAgent.InitWithAppId("你的APPID");
#endif

        BuglyAgent.EnableExceptionHandler();

    }

private void OnGUI()
    {
        if(GUI.Button(new Rect(100,100,100,50),"数组超范围")){
            byte[] byteArr = new byte[20];
            byteArr[21] = 0x11;
        }
        if(GUI.Button(new Rect(100,200,100,50),"Null")){
            GameObject obj = null;
            obj.transform.SetParent(this.transform);
        }

    }


4:打包Xcode工程:

添加相关依赖包:

  • libz.dylib - 用于对上报数据进行压缩
  • Security.framework - 用于存储keychain
  • SystemConfiguration.framework - 用于读取异常发生时的系统信息
  • JavaScriptCore.framework - 设置为Optional
  • libc++.dylib - libc++库依赖

5:填坑

(1)Not found class 'Bugly',解决方法:删除并重新添加Bugly.framework依赖就可以

[BuglyAgent] <Debug> -  : Enable the log message print to console

2018-06-06 15:45:56.908010+0800 gps[5156:2416485] <Error> BuglyAgentV2: Not found class 'Bugly'

[BuglyAgent] <Debug> -  : Initialized with app id: e8429856ea

[BuglyAgent] <Debug> -  : Register the log callback in Unity 5.6.4f1

[BuglyAgent] <Debug> -  : BuglyAgent has already been initialized.

Setting up 1 worker threads for Enlighten.

  Thread -> id: 16ed8f000 -> priority: 1 






  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值