如何让AndroidStudio一次显示所有编译错误? [英] How to let AndroidStudio show all compile errors at once?
问题描述
我很不情愿地从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
.然后,在B
或C
中没有显示错误:
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 Project
和Build > Rebuild Project
都不会标记错误的类,尽管它们已在编译日志中列出:
Neither Build > Make Project
nor Build > Rebuild Project
mark the errorneous classes though they are listed in the compile log:
仅在编辑器中打开B
或C
时,越野车类用红色下划线标出.
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屋!