3

I have a file with compilation errors in Android Studio module. Excluding this file from the gradle build causes the project compile successfully, but I still have red marks on the file (and as a consequence on the whole project), which is a bit annoying and confusing.

Android Studio screenshot

Is there any way to disable errors highlighting in Android Studio for files that are excluded from the gradle build?

JeB
  • 11,653
  • 10
  • 58
  • 87
  • Looks like bug with Android Studio. Can you delete file and add it to another changelist and never commit this change? – Eugen Martynov Sep 09 '15 at 15:31
  • Sorry, didn't get you... What changelists and commits have to do with my problem? – JeB Sep 10 '15 at 07:17
  • Can you just delete this file? – Eugen Martynov Sep 10 '15 at 07:49
  • It seems an obvious solution isn't it? :) Unfortunately I cannot do this, because the library is cross-project, and this file is necessary for another (non-android) project. – JeB Sep 10 '15 at 08:43
  • So the answer for my first and second question - you can not delete file. As I mention it looks like a bug in AS and I've tried to propose some workarounds how to remove distruction from red notification about non compilable class – Eugen Martynov Sep 10 '15 at 09:19
  • How do you make it compilable in the other non-android project? – Eugen Martynov Sep 10 '15 at 09:22
  • The non android project has all the necessary libraries (RCP framework) so it is compilable by definition. These libraries cannot be moved to android though. – JeB Sep 10 '15 at 09:33
  • 1
    Maybe you can move this class to that project instead? – Eugen Martynov Sep 10 '15 at 09:38
  • This could have been a solution if I hadn't have dozens of such projects. And this class (Activator) is a necessary component in each one of them. Unlikely I want to split each project into two different projects - the cross-project library and RCP specific project which utilizes it just because of one file. The elegant way to do this is excluding the redundant file from android build, which I did. But this lack of synchronization between gradle and AS is very annoying. – JeB Sep 10 '15 at 10:01
  • Maybe create another library project with this one class that depends on original and use original for android projects and new one for non-android – Eugen Martynov Sep 10 '15 at 10:03
  • As I mentioned, I don't want to split each project into 2 because of one file. I'm looking for some solution applicable to AS. – JeB Sep 10 '15 at 11:09

0 Answers0