Android Studio suddenly cannot resolve symbols

后端 未结 28 2552
南笙
南笙 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:10

    None of the things mentioned earlier here did actually work for me. But then I found this menu entry in the file menu Invalidate Caches/Restart which appears to have fixed the problem.

    I don't really know what happened in the background but when Android Studio started up again the status bar said Indexing... for a minute or so which apparently did wonders.

    For reference I'm using Android Studio 0.5.4.

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

    try to change your build.gradle with these value:

    android { compileSdkVersion 18 buildToolsVersion '21.0.1'

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 18
    }
    
    0 讨论(0)
  • 2020-11-22 05:13

    Please check if you have a project path which has special characters like ! (exclamation mark).

    In a similar problem that I experienced, this was the root cause - since many Java applications seem not to tolerate such special characters (For e.g. doing a 'gradlew clean' from the terminal would fail and throw a RunTimeException.). None of the other solutions posted online had helped me. But, once I had removed the ! from the path and did a clean build, Android Studio magically worked.

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

    I had a much stranger solution. In case anyone runs into this, it's worth double checking your gradle file. It turns out that as I was cloning this git and gradle was runnning, it deleted one line from my build.gradle (app) file.

    dependencies {
         provided files(providedFiles)
    

    Obviously the problem here was to just add it back and re-sync with gradle.

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

    Got the same problem today. Fixed it by changing the jdk location in the project structure from \java\jdk1.7.0_05 to \java\jdk1.7.0_25 (which I didn´t know existed until now).

    I´m using Android Studio 0.8.6.

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

    None of these solutions worked for me. I had to uninstall Android Studio all together, then remove all Android Studio related files (user files), then reinstall it again.

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