Redex 集成踩坑

一. 配置環境(MacOS)

xcode-select --install

brew install autoconf automake libtool python3

brew install boost jsoncpp

 

二. 安裝Redex

方式一: Homebrew 有直接可體驗版本,但比較老,不支持D8編譯器產生的APK

brew install redex

 

方式二: Clone源碼編譯最新版本,支持D8編譯器

1)git clone https://github.com/facebook/redex.git

 

2)安裝老版本的boost, 最新版本1.70有bug,導致源碼編譯失敗,看issue描述boost會在1.71版本修復這個bug。 1.70以後的releaes版本應該不需要安裝舊版本了

 

PS:不要用brew install [email protected]這種帶版本號的方式安裝其他版本,會導致環境路徑有誤,編譯還是會出錯。

 

brew uninstall boost

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/b4de2e1ce084ec249ca61c3eff6f96617e38c081/Formula/boost.rb

 

3)編譯源碼

cd redex

autoreconf -ivf && ./configure && make

 

4)如果之前通過homebrew安裝過redex,先卸載

brew uninstall redex

然後

sudo make install

 

至此,Redex應該是正確安裝了。

 

三. 使用

1. 源碼中的/config文件夾下有兩個配置,可以使用defalut.config來使用一下Redex

 

redex /path/to/apk/ -c default.config -o path/to/output/apk/

 

2. 如果處理的是proguard過的apk,需要在配置文件中配置proguard的mapping文件,幫助redex識別混淆的代碼

 

"proguard_map":"/Path/to/proguard_mapping_release.txt"

 

3. 可以通過-P指定一個Proguard rule, 使Redex遵循Prouard的rule防止誤刪類

-P common.cfg

 

4. 如果執行時有報錯,可以根據實際情況修改default.config中的passes節點,關閉導致錯誤的pass配置

 

5. 經過Redex處理過的apk需要重新簽名

1)簡單debug自動簽名可用--sign處理,不然無法安裝

2)用-s 指定keystore文件 -s path/to/android/keystore --sign

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章