2013-10-19 57 views

回答

3

更新2016-05:這裏的最終解決方案:

http://tools.android.com/tech-docs/new-build-system/resource-shrinking

---老答案--- 無據我所知。

你使用的是linux/Mac嗎?我公司開發的劇本由我自己來做到這一點:

佈局文件,執行在佈局目錄:

for f in *; do f=`echo $f | sed 's/.xml//g'`; echo $f; grep layout.$f -r ../../src .. >/dev/null; if [ $? != 0 ]; then rm $f.xml;fi done 

圖片:在項目的根目錄執行

find . -name "*png" -o -name "*jpg" | awk -F/ '{print $NF}'|awk -F. '{print $1}'|sort|uniq > imgs 
for f in `cat imgs`; do echo $f; grep drawable.$f -r src res >/dev/null; if [ $? != 0 ]; then find res -name $f.* -exec rm {} \; ;fi; done 
+0

我使用Windows,確實你的腳本對它有用嗎? – user2761885

+0

不,它不。你可能想嘗試一下cygwin,但是很容易使所有這些工作。 – Shawn

+0

@Shawn,你可以稍微解釋一下你的腳本是如何工作的嗎? –