Redex
** github地址**:https://github.com/facebook/redex
优点:使用Redex优化减少包体积,加载启动速度。
缺点:如果程序出现问题,定位问题点很难。
macOS
xcode安装好了的可以跳过安装
xcode-select --install
Install dependencies using homebrew:
brew install autoconf automake libtool python3
brew install boost jsoncpp
git clone https://github.com/facebook/redex.git
cd redex
#if you're using gcc, please use gcc-4.9
autoreconf -ivf && ./configure && make -j4
sudo make install
可选操作:
./test/setup.sh
cd test
make check
生成新包:
To use ReDex, first build your app and find the APK for it. Then run:
redex path/to/your.apk -o path/to/output.apk
例如:
redex /Users/.../105.apk -o /Users/.../107.apk
出现如下错误:
Couldn't find zipalign. See README.md to resolve this.
Traceback (most recent call last):
File "/tmp/redex.ce7j6x/redex.py", line 893, in <module>
run_redex(args)
File "/tmp/redex.ce7j6x/redex.py", line 876, in run_redex
finalize_redex(state)
File "/tmp/redex.ce7j6x/redex.py", line 788, in finalize_redex
state.args.keyalias, state.args.keypass, state.args.ignore_zipalign, state.args.page_align_libs)
File "/tmp/redex.ce7j6x/redex.py", line 344, in create_output_apk
zipalign(unaligned_apk_path, output_apk_path, ignore_zipalign, page_align)
File "/tmp/redex.ce7j6x/redex.py", line 298, in zipalign
raise Exception('Zipalign failed to run')
Exception: Zipalign failed to run
ANDROID_SDK=/Users/../sdk redex /Users/.../105.apk -o /Users/../107.apk。
中间的省略号是文件路径。
网友评论