如何让 AndroidStudio 一次显示所有编译错误? [英] How to let AndroidStudio show all compile errors at once?

查看:55
本文介绍了如何让 AndroidStudio 一次显示所有编译错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不情愿地从 Eclipse 转向 AndroidStudio 来开发应用程序(仅限于此).真正让我烦恼的是 AndroidStudio 并没有一次显示所有编译错误,或者我直到现在还没有找到正确的选项.

Reluctantly I turned from Eclipse to AndroidStudio for developing apps (only for that). What is really annoying to me is that AndroidStudio does not show all compile errors at once or I haven't found the right option till now.

首先考虑到这些愚蠢的类,一切都很好:

Given these stupid classes first everything is fine:

A.kt

package so

class A(val a: Int) {

    fun add(b: Int): Int {
        return a + b
    }
}

B.kt

package so

class B {

    fun foo() {
        val a = A(1)
        val c = a.add(2)
    }
}

C.kt

package so

class C {

    fun bar() {
        val a = A(3)
        val c = a.add(4)
    }
}

现在,如果我在 A 中并且错误地从方法名称 add 中删除了一个字母,那么它的名称变成了 ad.然后,在 BC 中没有显示错误:

Now, if I'm in A and by mistake remove a letter from method name add so its name becomes ad. Then, no error is shown in B or C:

Build > 都没有Make ProjectBuild >Rebuild Project 标记错误的类,尽管它们在编译日志中列出:

Neither Build > Make Project nor Build > Rebuild Project mark the errorneous classes though they are listed in the compile log:

仅当在编辑器中打开 BC 时,错误类才会用红色下划线标出.

Only if opening B or C in the editor the buggy class are underlined in red.

有时我在另一个地方更改了一些代码后很长一段时间都会检测到语法错误.

Sometimes I detect syntax errors a long while after changing some code at another place.

是否有任何解决方案,我监督过的任何选项?

Is there any solution for this, any option I have overseen?

推荐答案

这是一个已知问题.某些版本的 Kotlin 在某些版本的 Android Studio 中隐藏了构建错误.因此,令人沮丧的是 Android Studio 没有在 Messages 标签中显示它们.但是您仍然可以找到所有错误 - 您必须打开 Gradle Console 才能找到它们.

That's a known issue. Some versions of Kotlin hide build errors in some releases of Android Studio. Thus, Android Studio frustratingly doesn't display them in the Messages tab. But you can still find all the errors – you have to open the Gradle Console to get to them.

希望这会在 AS 的未来版本中得到修复.

Hope this will be fixed in a future releases of AS.

这篇关于如何让 AndroidStudio 一次显示所有编译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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