So I downloaded a template from http://www.androidbootstrap.com/ and I was able to compile and deploy it after changing a few things. However, there are errors in every java and layout file. All of the libraries are showing up with red underlines in the imports section and all of their functions are doing the same. It's not able to find the functions when I'm editing, but when building it seems to be fine. What can I do to fix this?
-
It was a bug in AS 0.4.2 which is solved with release 0.4.3 . Upgrde your As to 0.4.3 . – Piyush Agarwal Feb 06 '14 at 04:24
-
I have the latest version as of this post. – Caleb Jares Feb 06 '14 at 15:05
-
you can try this http://stackoverflow.com/questions/21100688/android-studio-0-4-2-suddenly-cannot-resolve-symbols/21100896#21100896 – Piyush Agarwal Feb 06 '14 at 15:13
-
After changing anything in your build.gradle files, you need to click on the Sync Project with Gradle Files button; have you tried that? – Scott Barta Feb 06 '14 at 17:10
4 Answers
Caches files must be corrupted.
Go to menu File
and select Invalidate Caches / Restart

- 16,865
- 6
- 62
- 72
None of these solutions helped me solve my problem. I ended up creating a new project and giving up on Android Bootstrap because I could never get it to work. Things I do now to ensure gradle behaves well:
- Updated Android Studio via the help menu. The latest version downloaded from Google was actually 0.4.2, and I was able to upgrade to 0.4.4.
- Created a new project, without much fluff.
- Made sure I could build the project and deploy.
- When I added libraries, such as androidannotations, I added them to the second level gradle.build file and then immediately went to tools-->refresh project from gradle. Then I made sure the project built. This is important because your project won't import the library until you refresh the project from gradle.
Hopefully this helps some people who are getting into gradle development.

- 6,163
- 6
- 56
- 83
I had a similar problem. In my case the solution was that I had to add maven { url 'https://jitpack.io' }
in settings.gradle
.

- 69
- 1
- 5
-
2Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 13 '22 at 11:15
-
I don't use Android Studio, so I can't say for sure. However, I do use its cousin IntelliJ. It sounds like Studio doesn't know about your Gradle build file. In IntelliJ, the Gradle plugin needs to be installed, and you need to add the build file to the project (or create a new project from an existing file). I would think those would be automatic in Studio. Regardless, try to see if something comparable applies for you.

- 29,932
- 7
- 42
- 70