19

MAIN QUESTION

The main question is still unanswered: Is there a way to change the limit that is printed to the console in android studio?

OLD CONTENT

I'm using code generation libraries. So a single error can suddenly lead to hundreds of errors resulting in this single error.

Currently I've the problem that I can't find the error, as I get 200 errors of error: cannot find symbol class ......

How can I change the limit of 200 to a bigger number?

EDIT

No code, as it is a android studio question

EDIT2

I know, it can happen if I open a xml file and insert some invalid code (by accident). It just happens by accident... The problem is, that android studio stops writing the errors to the error output console before the actual error source is visible...

SOLUTION FOR MY PROBLEM

In my special case I added a field to class and declared it as private. This lead to the problem, that the code generator for parcelable failed. It prints an error, but it can't be seen due to the 200 errors limit...

prom85
  • 16,896
  • 17
  • 122
  • 242
  • No code? No `build.gradle`? – Jared Burrows Aug 03 '15 at 17:04
  • edit 1 is for you... so no... I can't provide a code... – prom85 Aug 03 '15 at 17:06
  • possible duplicate of [Android Studio: Where is the Compiler Error Output Window?](http://stackoverflow.com/questions/16633956/android-studio-where-is-the-compiler-error-output-window) – Viktor Yakunin Aug 03 '15 at 17:21
  • as I can see 200 lines, I know where the compiler output is, though some interesting tipps for extended output where in the linked thread – prom85 Aug 03 '15 at 18:33
  • Hey, experiencing the same. Did you find the solution? Cheers. – Raj Lalwani Oct 21 '15 at 13:11
  • No I didn't... Only to be careful... In my case this only happens if I remove an id and this id is used somewhere in annotations... – prom85 Oct 21 '15 at 13:13
  • :( I am using Squidb and facing the similar issues. it's autogenerated code gives so many errors that now I can't find out the real reasons for the error. I am clueless at the moment what to do. I have scan the code thrice since morning ... – Raj Lalwani Oct 21 '15 at 13:28
  • had the problem with that library too... opening up every source file in your project may help as android studio will highlight a missing resource id... Or reverting to a previous if you can't solve it that way... – prom85 Oct 21 '15 at 13:39

3 Answers3

50

Add this to your Build.gradle

allprojects {
  gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xmaxerrs" << "1000"
    }
  }
}
DallinDyer
  • 1,378
  • 13
  • 14
7

Also, the Kotlin DSL equivalent is:

 gradle.projectsEvaluated {
        tasks.withType(JavaCompile::class) {
            options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
        }
    }
Saeed Masoumi
  • 8,746
  • 7
  • 57
  • 76
1

"error: cannot find symbol class" means your build.gradle file doesn't contain a reference to the classes that your source code refers to. Adding a library to the project structure will only affect the IDE you're using, and not the actual build script Gradle uses to actually compile your work.

For instance, if you have several Jar files in your libs folder at the root of your project, you need to make sure your build script compiles with them:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
Cruceo
  • 6,763
  • 2
  • 31
  • 52
  • I'm sure it's not that... It's not that I don't know how to use libraries, it's just, that there is a error (probably I pressed cmd+v or typed while being in another window) and now this error would only be printed to the output after all the other errors that result in such a thing... – prom85 Aug 03 '15 at 17:08
  • So is this within Android studio's console or during actual compilation? I think there's a good chance I misread the original question. – Cruceo Aug 03 '15 at 17:11
  • it's during the compilation... cleaning the project works fine, executing doesn't... all the classes exist and don't display any error... – prom85 Aug 03 '15 at 17:15
  • Are all the errors you're getting "cannot find symbol class" or are there different types? And from your post edits, it seems like you might think it has to do with some accidentally-added invalid xml; is there any way for you to rollback to a previously-working version to confirm that it may be the case? – Cruceo Aug 03 '15 at 17:27
  • yes, all... and all classes that are mentioned can be opened and look error free... yes, i could... but I want to avoid that as in the past this error could be solved by looking at the last errors... as there always was the file with the problem in it... if I can't change the limit (although it may be defined in some settings file?) i have to go that way anyway... – prom85 Aug 03 '15 at 17:30
  • Have you tried building it in the terminal with the --full-stacktrace option to see a verbose log of exceptions? i.e. "path/to/gradle/gradlew build --full-stacktrace" I'm not entirely sure it can be done directly in Android studio as I'm not familiar with it, but this should at least show you specifically what's failing – Cruceo Aug 03 '15 at 17:36
  • I did what you suggested first... I reverted to a prior version, copied back folder/classes and could narrow down to one file... The problem: a code generator for parcelable failed because I had added a private field and it can only generate code for protected, public and default fields... but this error does never show up in the log... because of the 200 errors limit... – prom85 Aug 03 '15 at 18:18