Remove jar file in apk

如果不想在 apk 裡包入某個 jar 檔 (使用 device 上的, 或者某版本沒提供某種功能) 有兩種方式: 一個是加法, 一個是減法.

加法就是透過 configuration 的設定, 在 compile 時才把把該檔案加入 class path 參考: https://gist.github.com/shakalaca/6551508

減法就是在 dex task (compile task 之後) 開始處理 jar 檔前, 把 jar 檔從 library 路徑中移除: https://gist.github.com/shakalaca/6551576

一開始最直覺的方式就是加法, 但後來發現我需要的是在某個 build 不放置 jar 檔, 才有了減法的作法, 但感覺有些醜, 再想想有沒有更好的方式..


comments powered by Disqus