前言:新接手的项目中接入了Bugly错误统计,但是没有自动上传dSYM文件,需要手动上传。按照官方文档资料操作,最后却发现管理后台提供的上传入口已关闭,需要通过api上传,以下记录了整个上传操作过程。
本机环境:macOS Big Sur 11.4
本文更新:2021.08.04
Bugly官方公告:
【系统公告】尊敬的用户,因系统功能调整,符号表上传不再支持老版本(小于3.3.4)上传,请使用最新版本上传工具3.3.4(https://bugly.qq.com/v2/downloads),望知悉。
所以之前写的上传符号表流程走不通了
-
最新解决方案
1、安装1.8.0版本Java运行环境
百度云链接: https://pan.baidu.com/s/1X-JMOsMcFLAO5tOcMskQ7g 密码: cjg6
安装完成后,查看java版本
java -version
输出信息如下1.8.0_xxx
,则正确
java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
注意:
如输出类似如下16.x.x
,则错误
java version "16.0.1" 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
出错的原因是因为电脑中有更高的java版本,需要手动删除。
打开指定路径下文件,删除高版本
/Library/Java/JavaVirtualMachines/
再次打印java版本验证是否正确
2、下载最新版Bugly iOS符号表工具 '3.3.4'
包含jar包和教程
buglyqq-upload-symbol.jar
符号表上传工具使用说明.doc
3、桌面创建空白文件夹,命名testBugly
。将生成的dSYM文件和上述工具包中的buglyqq-upload-symbol.jar
拖入文件夹中
4、配置信息,上传符号表
参数注释可查看符号表上传工具使用说明.doc
文档,注意参数和最后的dSYM路径一定要填写正确
java -jar buglyqq-upload-symbol.jar -appid xxxxxx -appkey xxxxxx-xxxx-xxxxx-xxxx-xxxxxx-bundleid com.xxxx.xxxx -version 3.1.12 -platform IOS -inputSymbol /Users/aha/Desktop/testBugly/xxx.app.dSYM
最后显示如下内容时表示上传成功
##[info]retCode: 200 response message: {"statusCode":0,"msg":"success","uploadReqID":"0d51635151-e46065cc-0f3a-4508-bdab-fe359c8ebfc7"}
分割线
-
以下为已废弃流程
1、下载符号表提取工具依赖的Java运行环境(JRE或JDK版本需要>=1.6)
已下载好版本jdk-8u291-macosx-x64
百度云链接: https://pan.baidu.com/s/1egC__F5GVTolaTrz52G96w 密码: hnjs
安装完成后,查看java版本
java -version
输出
java version "16.0.1" 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
2、下载最新版Bugly iOS符号表工具
其中工具包中包括:
- 符号表工具JAR包(buglySymboliOS.jar)
- Windows的脚本(buglySymboliOS.bat)
- Shell脚本(buglySymboliOS.sh)
- 默认符号表配置文件(settings.txt)
- 符号表工具iOS版-使用指南
3、桌面创建空白文件夹,命名testBugly。将生成的dSYM文件和上述工具包中的buglySymboliOS.jar拖入文件夹中
4、 生成新的符号表文件
终端中操作
cd /Users/ahamac/Desktop/testBugly
java -jar buglySymbolIOS.jar -i /Users/ahamac/Desktop/testBugly/hhh.app.dSYM
5、上传生成的新的符号表文件
首先压缩下dSYM文件生成zip压缩包,终端中操作
curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=8ccc-1ccc-4ccc-9ccc-6ccc&app_id=0d11111111" --form "api_version=1" --form "app_id=0d11111111" --form "app_key=8ccc-1ccc-4ccc-9ccc-6ccc" --form "symbolType=2" --form "bundleId=com.xxxx.xxxx" --form "productVersion=3.3.3" --form "fileName=hhh.app.dSYM.zip" --form "file=@buglySymbol_hhh_arm64-2d5e4.zip" --verbose
最后显示如下内容时表示上传成功
{"rtcode":0,"msg":"Success","data":{"reponseCode":"0"}}* Closing connection 0
备注:
- app_key和app_id在bugly管理后台
- api_version:固定1
- symbolType: 固定2
- bundleId: app项目bundleId
- productVersion: app项目对应的版本
- fileName: dSYM文件生成zip压缩包名称
- file: 步骤4中生成的新的符号表文件
最后附上全部终端内容
ahamac@aha-Pro Desktop % cd /Users/ahamac/Desktop/testBugly
ahamac@aha-Pro testBugly % java -jar buglySymbolIOS.jar -i /Users/ahamac/Desktop/testBugly/hhh.app.dSYM
/Users/ahamac/Desktop/testBugly/hhh.app.dSYM/Contents/Resources/DWARF/hhh [arm64] 2d5e48dc854b3ba8b5c56e06b1671cb1
[SymtabTool-I] Extracting symtab file: hhh
[SymtabTool-I] Begin to parse file: /Users/ahamac/Desktop/testBugly/hhh.app.dSYM/Contents/Resources/DWARF/hhh
[SymtabTool-I] Architecture: arm64
[SymtabTool-I] Successfully parsed the file!
[SymtabTool-I] Begin to parse file: /Users/ahamac/Desktop/testBugly/hhh.app.dSYM/Contents/Resources/DWARF/hhh
[SymtabTool-I] Architecture: arm64
[SymtabTool-I] Successfully parsed the file!
[SymtabTool-I] Begin to extract symbol table.......................................................................................
[SymtabTool-I] Successfully to extract symbol table!
[SymtabTool-I] Begin to create symtab file: /Users/ahamac/Desktop/testBugly/hhh.app.dSYM/Contents/Resources/DWARF/buglySymbol&%E8%80%81%E6%9D%BF%E9%80%9A&arm64&2d5e48dc854b3ba8b5c56e06b1671cb1.symbol
[SymtabTool-I] Successfully created symtab file!
[SymtabTool-I] Begin to parse the file:/Users/ahamac/Desktop/testBugly/hhh.app.dSYM/Contents/Resources/DWARF/buglySymbol&%E8%80%81%E6%9D%BF%E9%80%9A&arm64&2d5e48dc854b3ba8b5c56e06b1671cb1.symbol
[SymtabTool-I] Successfully parsed the file
[SymtabTool-I] Begin to construct stif file: /Users/ahamac/Desktop/testBugly/老hhh.app.dSYM/Contents/Resources/DWARF/buglySymbol&%E8%80%81%E6%9D%BF%E9%80%9A&arm64&2d5e48dc854b3ba8b5c56e06b1671cb1.stif
[SymtabTool-I] Successfully constructed stif file
[SymtabTool-I] Add stif to symtab zip file: /Users/ahamac/Desktop/testBugly/hhh.app.dSYM/Contents/Resources/DWARF/buglySymbol&%E8%80%81%E6%9D%BF%E9%80%9A&arm64&2d5e48dc854b3ba8b5c56e06b1671cb1.stif
[SymtabTool-I] Begin to zip symtab file: /Users/ahamac/Desktop/testBugly/buglySymbol_hhh_arm64-2d5e4.zip
[SymtabTool-I] Successfully zipped symtab file!
ahamac@aha-Pro testBugly % curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=8ccc-1ccc-4ccc-9ccc-6ccc&app_id= 0d11111111" --form "api_version=1" --form "app_id= 0d11111111" --form "app_key=8ccc-1ccc-4ccc-9ccc-6ccc" --form "symbolType=2" --form "bundleId=com.xxxx.xxxx" --form "productVersion=3.3.3" --form "fileName=hhh.app.dSYM.zip" --form "[email protected]" --verbose
curl: (26) Failed to open/read local data from file/application
ahamac@aha-Pro testBugly % curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=8ccc-1ccc-4ccc-9ccc-6ccc&app_id= 0d11111111" --form "api_version=1" --form "app_id= 0d11111111" --form "app_key=8ccc-1ccc-4ccc-9ccc-6ccc" --form "symbolType=2" --form "bundleId=com.xxxx.xxxx" --form "productVersion=3.3.3" --form "fileName=hhh.app.dSYM.zip" --form "file=@buglySymbol_hhh_arm64-2d5e4.zip" --verbose
* Trying 111.161.111.119...
* TCP_NODELAY set
* Connected to api.bugly.qq.com (111.161.111.119) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=CN; ST=guangdong; L=shenzhen; O=Tencent Technology (Shenzhen) Company Limited; CN=*.sept03.sparta.3g.qq.com
* start date: Sep 27 04:45:44 2020 GMT
* expire date: Oct 29 04:45:44 2021 GMT
* issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
* SSL certificate verify ok.
> POST /openapi/file/upload/symbol?app_key=8ccc-1ccc-4ccc-9ccc-6ccc&app_id= 0d11111111 HTTP/1.1
> Host: api.bugly.qq.com
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 8508885
> Content-Type: multipart/form-data; boundary=------------------------9ed226e5fb5bf864
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 25 Jun 2021 03:48:02 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 55
< Connection: keep-alive
< Set-Cookie: JSESSIONID=f26a766c-2037-4195-8b6f-b8c2d22f366a; Path=/; HttpOnly
< Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Thu, 24-Jun-2021 03:47:55 GMT
<
* Connection #0 to host api.bugly.qq.com left intact
{"rtcode":0,"msg":"Success","data":{"reponseCode":"0"}}* Closing connection 0
ahamac@aha-Pro testBugly %