Android——Android Studio的一些小技巧

來源:互聯網
上載者:User

標籤:

APK瘦身

在Android Studio中我們可以開啟混淆,和自動刪除沒有Resources檔案,來達到給APP瘦身的目的,這對於一些維護很久的老項目比較有用,
裡面有很多無效的Resource, 刪除後產生的APK會小很多

我們只需要在項目的build.gradle中加入

android {    buildTypes {        release {            minifyEnabled true            shrinkResources true        }    }}

 

minifyEnabled 是開啟混淆
shrinkResources 刪除無效的Resource
shrinkResources依賴於minifyEnabled,必須和minifyEnabled一起用。

多語言編輯器

我們在Android Studio開啟一個String.xml檔案,IDE會提示你使用多語言編輯器,這個真是個好東西,我們可以在這裡把所有語言的字串一併填上,還可以以紅色標示哪些還沒有翻譯的。

Selector自動產生器

這個外掛程式需要安裝,我們可以在Preferences→Plugins→Browse repositories 搜尋SelectorChapek安裝

1) 在資源檔目錄點擊右鍵,比如選擇’drawable-xhdpi’

2) 選擇’Generate Android Selectors’

3) 所有的selectors會自動產生到’drawable’檔案夾

外掛程式地址:SelectorChapek for Android

Logcat顏色自訂

Android Studio裡Logcat對於不同層級,預設基本上都是灰色,
我們可以在設定裡對Logcat的顏色進行自訂

 分類: Android

Android——Android Studio的一些小技巧(轉)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.