Android Studio and android.support.v4.app.Fragment: cannot resolve symbol

后端 未结 22 2712
眼角桃花
眼角桃花 2020-12-01 06:03

I am tryng out Android Studio instead of Eclipse. I install it and then start a completely new project and follow the wizard. I add no code of my own.

Then, I right-

相关标签:
22条回答
  • 2020-12-01 06:41

    "File" -> "Invalidate Caches..."

    worked for me.

    0 讨论(0)
  • 2020-12-01 06:41

    Closing and Re-Importing project worked for me.

    0 讨论(0)
  • 2020-12-01 06:44

    For everyone who comes to this thread and builds with maven: add support-v4 dependency and build to download the repo.

    Then add the library manuelly to your project:

    Project Structure -> Libraries -> Add

    And move to you're repo for the correct jar file: C:\Users\XXXXXXX\.m2\repository\com\google\android\support-v4\r7\support-v4-r7.jar

    0 讨论(0)
  • 2020-12-01 06:47

    The symptom of this problem is usually that the build works fine from the command line (which means your build.gradle file is set up right) but you get syntax highlighting errors in the IDE. Follow This Steps To Solve The Problem: Click on Tools from the toolbar usually at the top part of your IDE, and then navigate to Android then navigate to Sync Project with Gradle Files button. We realize it's less than ideal that the IDE can't just take care of itself instead of forcing you to manually sync at the right time; we're tracking progress on this in https://code.google.com/p/android/issues/detail?id=63151

    0 讨论(0)
  • 2020-12-01 06:48

    I'm running the most current version of AndroidStudio to date (11/10/2015) -- v1.4 (build AI-141.2288178, built on September 28, 2015) and I built my project and everything worked fine. Then after a few hours of my computer being inactive I came back, edited some code that had nothing to do with the support libraries and started seeing :

    cannot resolve symbol 'fragmentactivity' and I was seeing red highlighted items related to fragmentactivity in the AndroidStudio editor.

    The solution was to simply do a

    Build...Rebuild Project...

    I only mention this so others might see it and know it is happening out there.

    0 讨论(0)
  • 2020-12-01 06:49

    For me : Build->Clean Project solved this question

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