android studio 技巧

1. Module的移除

先要在File—>Project Structure 或者 此模塊右鍵--》 open module setting 中將此module“減“掉後才能在項目中Module右鍵的Delete鍵可用。 


2.修改Logcat顏色

http://www.cnblogs.com/kangyi/p/5083680.html


3. 顯示行號

Settings --> Editor --> Appearance ,勾選 Show line numbers 。


4. 顯示空格。

這樣就能看出縮進是 tab 縮進還是空格縮進。建議使用空格縮進。
Settings --> Editor --> Appearance ,勾選 Show whitespaces 。


5.Android Studio會提醒你 JDK 或者 Android SDK 不存在,你需要重新設置。你需要到全局的Project Structure 頁面下進行設置。進入全局的 Project Structure 頁面方法如下:

  -- 在歡迎界面,選擇 Configure --> Project Defaults --> Project Structure

  -- 選擇 File --> Other Settings --> Default Project Structure

 

6. 統一文件編碼。出於字符兼容的問題,建議使用 utf-8 。
   Settings --> File Encodings 。建議將 IDE Encoding 、 Project Encoding 、 Properties Fiels 都設置成統一的編碼。


7. 如何添加依賴,以及依賴的類型

    進入 Project Structure  -- dependencies 下按+後添加依賴。

    依賴類型的含義:

   

Compile 

compile是對所有的build type以及favlors都會參與編譯並且打包到最終的apk文件中。

Provided 

Provided是對所有的build type以及favlors只在編譯時使用,類似eclipse中的external-libs,只參與編譯,不打包到最終apk。

APK 

只會打包到apk文件中,而不參與編譯,所以不能再代碼中直接調用jar中的類或方法,否則在編譯時會報錯

Test compile 

Test compile 僅僅是針對單元測試代碼的編譯編譯以及最終打包測試apk時有效,而對正常的debug或者release apk包不起作用。

Debug compile 

Debug compile 僅僅針對debug模式的編譯和最終的debug apk打包。

Release compile 

Release compile 僅僅針對Release 模式的編譯和最終的Release apk打包。



8. 以release 方式編譯 ,選中 build - 》 select build variants ,將debug更改爲 release。運行即可

       

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