简体   繁体   English

如何抑制编译Java时找不到符号错误?

[英]How to suppress Cannot Find Symbol error when compiling java?

I'm using Dagger, Room and DataBinding to develop my application, these libraries generate massive codes. 我使用Dagger,Room和DataBinding开发应用程序,这些库生成大量代码。 When something wrong happened in my code, these libraries stop generating codes and produce massive Cannot Find Symbol error, which is annoying. 当我的代码中发生错误时,这些库将停止生成代码,并产生大量的“找不到符号”错误,这很烦人。

And java compiler will only output first 100 errors, which makes situation worse, I can't even knows where is the error of my code! 而且Java编译器只会输出前100个错误,这使情况更糟,我什至不知道我的代码的错误在哪里! Because all errors are 'Cannot Find Symbol'. 因为所有错误都是“找不到符号”。

Is there anyway to suppress these Cannot Find Symbol errors, or, at least, shows dagger or databinding errors before these errors? 是否有办法抑制这些“找不到符号”错误,或者至少在出现这些错误之前显示匕首或数据绑定错误?

You can increase Error Limit . 您可以增加错误限制

Just include below lines in your grade 只需在您的成绩中包括以下几行

Java 爪哇

allprojects{
  afterEvaluate{
     tasks.withType(JavaCompile.class) {
       options.compilerArgs << "-Xmaxerrs" << "500"
     }
   }
 }

Kotlin 科特林

kapt {
    javacOptions {
        option("-Xmaxerrs", 500)
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM