您的位置:首页 > 移动开发 > Android开发

Android Studio的一些配置(去拼写检查、自动import、大小写智能提示等)

2015-06-15 10:52 507 查看
偶尔使用Android Studio写App,由于习惯了ADT的一些配置,如大小写均智能提示等,因此在AS中感觉非常不习惯,不过不用担心,AS也可以做上述配置,满足你的要求。

1.去拼写检查

AS默认会对代码做拼写检查,如果检查有错的话会打上波浪线,当然这并不影响编译运行,但如果对代码有高度的整洁规范要求,则似乎不可容忍,具体做如下配置,可以关闭AS的拼写检查。



File-->Settings,在左侧面板选择Editor-->Inspections,右侧找到Spelling选项,将其后面复选框的对勾去掉,然后保存即可。

2.自动import

在AS中可以通过Alt+Enter逐个导入import,但这样效率太低了,做如下配置,AS就可以为我们导入所有确定的import,如下图:



File-->Settings,在左侧面板选择General-->Auto Import,右侧选中Add unambiguous imports on the fly,然后保存即可。

3.输入大小写都能够智能提示

在AS中默认的智能提示是区分大小写的,一般的coding模式是小写,但类名基本是大写,如果在输入时切换大小写则会大大影响编码效率,因此需要让AS无论大小写都支持智能提示,具体配置如下图:



File-->Settings,在左侧面板选择General-->Code Completion,右侧将Case sensitive completion设置为None,然后保存即可。

4.Gradle构建时发生空间不够的情况

具体报错如下:

Error:Unable to start the daemon process.

This problem might be caused by incorrect configuration of the daemon.

For example, an unrecognized jvm option is used.

Please refer to the user guide chapter on the daemon at 
http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:

-----------------------

Error occurred during initialization of VM

Could not reserve enough space for object heap

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

解决方案配置如下:



File-->Settings,在左侧面板选择Build,EXecution,Deployment-->Gradle,右侧将Gradle VM options设置为-Xmx512m,然后保存即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Android Android Studio