Android Studio suddenly cannot resolve symbols

后端 未结 28 2587
南笙
南笙 2020-11-22 04:42

Android Studio 0.4.2 was working fine and today I opened it and almost everything was red and the auto-completion had stopped working. I look at the imports and AS seems to

相关标签:
28条回答
  • 2020-11-22 05:16

    I have finally figured out what causes this issue.

    Actually, you should avoid pushing .idea/libraries folder to your repository. It creates weird stuff in Android Studio which tends to remove all downloaded libraries.

    If you have commit history, just recreate all missing library files and avoid them to be committed again. Otherwise, just remove whole .idea folder and reimport it into AS.

    0 讨论(0)
  • 2020-11-22 05:17

    In my multi-module project, the problem was that version of "com.android.support:appcompat-v7" in module A was "22.0.0", but in B - "22.2.0".

    Solution: make sure
    1. version of common libraries is same among modules.
    2. each of modules compiles without any errors (try to build each of them from CLI).

    0 讨论(0)
  • 2020-11-22 05:19

    I faced similar problem but I followed following steps in my case :-

    1).inside project under .idea folder open modules.xml. 2).check if there are two entries for same iml file. 3).delete one of duplicate entry and close android studio or build gradle file again.

    In my case it worked. Hope it helps

    0 讨论(0)
  • 2020-11-22 05:20

    Another very subtle cause:

    Multi-flavor library should be compiled in specific way than a normal single-flavored. Otherwise it silently produces cannot resolve symbols error.

    Multi flavor app based on multi flavor library in Android Gradle

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