Android Studio:像Eclipse一样自动构建 [英] Android Studio : auto build like Eclipse

查看:27
本文介绍了Android Studio:像Eclipse一样自动构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Eclipse 多年后,我决定使用 Android Studio.但我发现 Android Studio 有一件坏事.事实上,似乎不可能像 Eclipse 那样具有自动构建功能.修改和保存文件时,我看不到我的项目是否有错误、警告等.

I decided to use Android Studio after using Eclipse since years. But I found one bad thing about Android Studio for me. Indeed, it seems it's not possible to have the auto build feature like in Eclipse. When files are modified and saved, I can't see if my project has errors, warnings, etc..

那么有什么方法可以启用此功能吗?

So is there any way to enable this ?

推荐答案

IntelliJ (Android Studio) 有一个与 Eclipse 完全不同的构建系统.它具有不同的增量编译.

IntelliJ (Android Studio) has a whole different build system to eclipse. It has incremental compiling that is different.

IntelliJ 会告诉您是否有错误/警告当前打开的文件.

IntelliJ will tell you if something has an error / warning the the CURRENT open file.

这么简短的回答,不,你不能.您将在打开文件时看到错误,您可以选择重建项目";从将向您显示这些错误的菜单.您还可以启用自动导入"对于 Gradle 可能会有帮助.

So short answer no you can't. You will see the errors as you open the files, you can select "rebuild project" from the menu which will show you these errors. You can also enable "auto-import" for Gradle that may help.

您不想一直进行重建项目".所以我建议你习惯它.

You don't want to be doing 'rebuild project' all the time. So I'd recommend getting used to it.

另外,你不应该依赖编译错误来编码,你应该安全地重构,当出现编译警告并且你必须修复它时应该是一个惊喜.

Also you shouldn't rely on compile errors for coding, you should safely refactor and it should be a surprise when something pop's up a compile warning and you have to fix it.

您应该阅读 IntelliJ 常见问题解答

You should read the IntelliJ FAQ

问:增量编译是怎么回事?我如何编译我的项目?

Q: What happened to incremental compilation? How do I compile my project?

A:它就在那里,但工作方式稍有不同.默认情况下IntelliJ IDEA 仅在需要时才编译文件(当您运行app 或显式调用 Make 操作),从而节省系统用于当前可能更重要的其他任务的资源.编译是增量的:IntelliJ IDEA 跟踪源文件和重新编译之间的依赖关系仅当文件具有已更改.

A: It's there, but works slightly other way. By default IntelliJ IDEA compiles files only when it's needed (when you run your app or explicily invoke the Make action), and so saves system resources for other tasks that can be more important at the moment. The compilation is incremental: IntelliJ IDEA keeps track of dependencies between source files and recompiles only if a file has been changed.

有编译错误的文件被高亮显示,文件夹也是包含它们 - 因此您可以通过项目视图轻松分析它们.到查看包含编译错误的所有文件的列表,选择 Scope |来自项目视图的视图为组合框的问题.每次之后编译,IntelliJ IDEA 不断执行后台代码分析有错误的文件,并删除红色突出显示当你修复它们时自动.

Files with compilation errors are highlighted, and so are the folders containing them — so you can easily analyze them via Project view. To see a list of all files with compilation errors, select Scope | Problems from the View As combobox of the Project view. After each compilation, IntelliJ IDEA constantly performs background code analysis on files with errors, and removes the red highlighting automatically when you've fixed them.

要在每次保存时启用编译文件,您可以使用 EclipseMode插件:http://plugins.jetbrains.com/plugin/?id=3822(第三者开发,不捆绑).

To enable compiling files on every save, you can use the EclipseMode plugin: http://plugins.jetbrains.com/plugin/?id=3822 (third-party development, not bundled).

为了能够运行有错误的代码,您可以选择 Eclipse在 Settings 对话框、Compiler、Java Compiler 中添加编译器并添加编译器的附加命令行参数的 -proceedOnError 选项.

To be able to run code with errors, you can select the Eclipse compiler in Settings dialog, Compiler, Java Compiler and add the -proceedOnError option to the Additional command line parameters for the compiler.

http://www.jetbrains.com/idea/documentation/migration_faq.html

这篇关于Android Studio:像Eclipse一样自动构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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