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

后端 未结 27 974
[愿得一人]
[愿得一人] 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 20:01

    In my case, for some reason, Android Plugin Version wasn't set. I did try clearing cache and removing .gradle and .idea as well, but it didn't work out and after finally wandering for hours, I found this.

    0 讨论(0)
  • 2020-11-29 20:01

    For me, I refer a jar in a module library. It cannot resolve the symbol in the jar. So I find the solution for my situation. Use the provided way.

    provided fileTree(include: ['xxx.jar'], dir: '../moduleX/libs')
    
    0 讨论(0)
  • 2020-11-29 20:02

    It seems that everyone uses a different approach for getting around these issues. I'll suggest another one that I feel is a bit less invasive than the others. When I introduce changes from an aar library that I include, I will open up the "settings.gradle" file for the project.

    Then cut out the main project module from the list of projects:

    include ':mainproj',

    and then sync your project. Then paste it back in and re-sync your project once more. I believe that this is the same as some of the manual deletion steps, but this lets you do so from the IDE a bit quicker and less painfully.

    0 讨论(0)
提交回复
热议问题