How to let AndroidStudio show all compile errors a

2019-04-08 08:33发布

问题:

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)
    }
}

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:

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

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?

回答1:

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.

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