前言:新接手的項目中接入了Bugly錯誤統(tǒng)計,但是沒有自動上傳dSYM文件健提,需要手動上傳。按照官方文檔資料操作伟叛,最后卻發(fā)現(xiàn)管理后臺提供的上傳入口已關(guān)閉私痹,需要通過api上傳,以下記錄了整個上傳操作過程。
本機(jī)環(huán)境:macOS Big Sur 11.4
本文更新:2021.08.04
Bugly官方公告:
【系統(tǒng)公告】尊敬的用戶紊遵,因系統(tǒng)功能調(diào)整账千,符號表上傳不再支持老版本(小于3.3.4)上傳,請使用最新版本上傳工具3.3.4(https://bugly.qq.com/v2/downloads)暗膜,望知悉匀奏。
所以之前寫的上傳符號表流程走不通了
-
最新解決方案
1、安裝1.8.0版本Java運行環(huán)境
百度云鏈接: 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瘫寝、桌面創(chuàng)建空白文件夾,命名testBugly
稠炬。將生成的dSYM文件和上述工具包中的buglyqq-upload-symbol.jar
拖入文件夾中
4焕阿、配置信息,上傳符號表
參數(shù)注釋可查看符號表上傳工具使用說明.doc
文檔酸纲,注意參數(shù)和最后的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
最后顯示如下內(nèi)容時表示上傳成功
##[info]retCode: 200 response message: {"statusCode":0,"msg":"success","uploadReqID":"0d51635151-e46065cc-0f3a-4508-bdab-fe359c8ebfc7"}
分割線
-
以下為已廢棄流程
1捣鲸、下載符號表提取工具依賴的Java運行環(huán)境(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)
- 默認(rèn)符號表配置文件(settings.txt)
- 符號表工具iOS版-使用指南
3栽惶、桌面創(chuàng)建空白文件夾,命名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
最后顯示如下內(nèi)容時表示上傳成功
{"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項目對應(yīng)的版本
- fileName: dSYM文件生成zip壓縮包名稱
- file: 步驟4中生成的新的符號表文件
最后附上全部終端內(nèi)容
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 "file=@hhh.app.dSYM.zip" --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 %