Any android Studio version > 3.2.1 show red resource but still compile
Asked Answered
V

1

1

Me and my team are blocked to Android Studio 3.2.1. Any android studio after this one show error for ressource. Ressource are still clickeable/inspectable from editor but are in red. Preview of fragment is KO too.

Work with : Android Studio 3.2.1 Gradle plugin version 3.2.1 Gradle version 4.6.1

But can't make it works on : Android Studio 3.5 Gradle plugin version 3.5 Gradle version 5.4.1

I have looked this topic : Android Studio inline compiler showing red errors, but compilation with gradle works fine

  • I have tried to clean/build + invalidate cache and restart.

  • I have tried to :

rm -rf .idea/caches/
rm -rf .idea/libraries/
rm -rf .gradle/
  • I also check all XML errors by analysing project and fixing all XML errors
  • The package name is correct in AndroidManifest.xml

What else could make this project bug ?

Here is a screenshot of what i got : screenshot

We see on it, it s red but still clickeable. My project compile too.

Venipuncture answered 23/8, 2019 at 9:41 Comment(1)
Not a solution, but I've had this happen on Macbook when having open more than 1 instance of AndroidStudio. Closing the other instance fixed it. Wierd.Rizo
V
0

I solved it after long other searchs.

Solution : My problem was i had 3 modules, but 2 of them had the same package name. I rename one and it solved my problem.

How i solved it:

  • First step, i checked if java files was the problems:

        1) I deleted all my .java files 
    
        2) Deleted all activity in androidmanifest.xml
    
        3) create a new empty activity 
    
  • Second step, i checked if xml files was the problem:

        1) I deleted all content in my res folder, except the layout of my empty activity
    
  • Third step, i checked if gradle library was the problem:

        1) I deleted one by one my dependencies in build.gradle
    

I found that my line who was injected the project in the dependencies was the cause of my problems :

implementation project(':XXX')

1) When i delete it, it was fixed.

2) Therefore, i inspect it and found that if i delete the androidmanifest.xml of XXX project, it solved my problem.

3) Debugging androidmanifest.xml, i found that the id was the problem.

It seems like that androidstudio after 3.2.1 doesn't allow multiple module with same package name. So, now, all my modules have specific package name.

Venipuncture answered 28/8, 2019 at 9:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.