Android Studio inline compiler showing red errors, but compilation with gradle works fine

后端 未结 27 971
[愿得一人]
[愿得一人] 2020-11-29 19:22

I\'ve set up my project in Android Studio to use the Square Wire library, as per this question.

Build -> Compile Project works fine.

<
相关标签:
27条回答
  • 2020-11-29 19:54

    For me deleting .gradle and .idea folder of project solved the problem.

    0 讨论(0)
  • 2020-11-29 19:54

    Below steps when the Project is succesfully compiled but with unresolved classes (All classes usage will be in red color in all files)

    Step 1. Delete .gradle file

    Step 2. Delete .idea file

    Step 3. Open new Android studio Window with some other android project on your system and close your Project with error

    Step 3 . Now Open/Import the Project once again from the studio toolbar Android Studio ->File -> Open

    Note: Now when you import the project the new .gradle and new .idea folders will be autogenerated with resolved dependencies by the compiler.

    0 讨论(0)
  • 2020-11-29 19:54

    None of the solutions worked for me..I resorted to uninstall java from my computer, running android studio to make sure it detected the uninstall and then installing it again.

    If you choose to go this way try changing the jdk path and setting the new path in the project structure. If that doesn't work, go ahead and uninstall java.

    0 讨论(0)
  • 2020-11-29 19:55

    Just do this on your Android studio:

    File -> Invalidate caches/Restart -> Invalidate and Restart

    This worked for me. No need to clear ./gradle or ./idea folder

    0 讨论(0)
  • 2020-11-29 19:55

    Solved the issue by cleaning project Build->Clean Project

    0 讨论(0)
  • 2020-11-29 19:56

    I am fixed by below method

    Method 1

    File > Invalidate Cache/Restart > Invalidate and Restart

    Method 2

    • If you are facing this error only for particular project, Then do this
       1. Close current project
       2. Go to your project path C://User/Android studio project/your project
       3. Delete two files .gradle and .idea
    
    • If you are facing this error for all projects, Then do this
    1. Close Android studio
    2. Go to the file C://Users/your username/
    3. Delete files .gradle , .cache ,.android, .AndroidStudio3.5
    
    0 讨论(0)
提交回复
热议问题