15

Unity – android profiling via adb

 4 years ago
source link: https://naclyen.com/2020/03/17/unity-android-profiling-via-adb/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

想必有很多人受到這種困擾, 最後有人受不了跑去decompiling, 才讓事情變得單純(?)

先講重點:

  1. 如果可以順利使用預設的AndroidPlayer([email protected]:34999)的話就直接使用即可.
    但會看到這篇應該都是不能用的災民吧~哈哈!!
  2. 建議先關掉所有防火牆/防毒軟體測試. (測試完記得開回來嘿!)
  3. 自訂IP的內容只需要填IP即可.
    O: 127.0.0.1
    X: 127.0.0.1:50000
  4. unity 偵測範圍落在55000~55511.
  5. 透過指令adb forward tcp:[Port] localabstract:Unity-[Package Name]打開adb的監聽渠道.

e.g. adb forward tcp:55000 localabstract:Unity-com.mygame.an

  1. 如果不行則在加另一個port, 直到都失敗為止.
  2. 至此還不行, 透過指令adb forward --remove-all把adb forward全砍了!!
  3. 重複5&6的步驟.
  4. 至此還不行, 就另請高明了 |||Orz…

先依照官網的說明設定好.
預設管道第一天還可以直接使用, 隔天就GG. 而後找到了這篇同樣困惑的災民的教學.
馬上就可以順利運作了!! (灑花

但就在當天午餐後, 本來早上設定的 55000 莫名其妙又失效(可能是被占住), 再換另一個 port 即可.
推測應該是某一邊咬住了該 port 造成無法使用, 移除之後應該就可以順利運作?
…有效!

adb forward 所需要的 [Package Name] 來自 player setting 內的 Package Name

移除 forward

adb forward --remove tcp:8080
adb forward --remove-all

列出監聽 port 的清單

使用 netstat.
On Windows: netstat -an | find /i "listening"
On Linux: netstat -an | grep "LISTEN " (notice the space after LISTEN)


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK