Android的工作室自动修复 [英] Android studio auto fix

查看:409
本文介绍了Android的工作室自动修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道确切的名称是像这个S功能,但我只是描述它。

I don't know what the exact name is for s feature like this, but I will just describe it.

我采用了android工作室,我加了一些Java类,从一个不同的项目。现在它说

I am using android studio and I added some java classes from a different project. Now it says

缺失的软件包声明:内容十分重要。但是,是不是在错误弹出选项,只是自动添加缺少的包语句。我知道这似乎懒得不会打字,但我想快些做的事情。

"missing package statement: yada yada". But there is not option in the error popup to just automatically add the missing package statement. I know it seems lazy to not type it, but I like to do things quickly.

当出现这样的错误,有没有一种方法机器人工作室自动添加code的需要线,如日食会吗?

When there is an error like this, is there a way for android studio to automatically added the needed lines of code like eclipse would?

推荐答案

这是一个共同的无奈。虽然不是一个完美的解决方案,我发现 http://stackoverflow.com/a/16616085/967131 来为我工作。

This is a common frustration. While not a perfect solution, I found http://stackoverflow.com/a/16616085/967131 to work for me.

对于Windows / Linux的,你可以去到文件 - >设置 - >编辑 - >常规
   - >自动导入 - > Java和进行以下更改:

For Windows/Linux, you can go to File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:

改变插入的进口上的粘贴值全部

change Insert imports on paste value to All

markAdd作为检查苍蝇选项unambigious进口

markAdd unambigious imports on the fly option as checked

在Mac上,做同样的事情Android Studio中 - > preferences

On a Mac, do the same thing in Android Studio -> Preferences

这样的话,当你键入,或当你复制和粘贴,很多进口量将被自动添加。那些没有不明确;把光标放在类,preSS Alt + Enter键,然后选择你的意思是阶级的版本。

That way, as you type, or when you copy and paste, many imports will be added automatically. Those that aren't are ambiguous; put the cursor on the class, press alt+enter and select which version of the class you meant.

这篇关于Android的工作室自动修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆