1. Module的移除
或者 此模块右键--》 open module setting 中将此module“减“掉后才能在项目中Module右键的Delete键可用。
2.修改Logcat颜色
显示行号
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。运行即可