2

When I started Android Studio I got a bunch of error messages saying a bunch of plugins were missing or uninstalled or whatever. I restarted Android Studio a couple of times and it seemed as though that problem fixed itself. (No idea what was going on there.)

Then a new problem arised. The project I have been working on seems to be damaged/corrupt. I don't know how or why. Here's what it says:

Information:Gradle tasks [:app:assembleDebug] C:\Users\Peter\AndroidStudioProjects\AlarmClock\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. C:\Users\Peter\AndroidStudioProjects\AlarmClock\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt Information:BUILD FAILED Information:Total time: 1.255 secs

I booted up another project and it worked just fine.

The last thing I did with the corrupt project was change something (not sure why) and as a result it would crash every time I clicked a certain button while running the project. I was about to start debugging it today, when this whole mess happened.

In MainActivity it says:

Cannot Resolve Symbol 'R'

I imagine that's a bad thing..

EDIT: I got it working, but I still have an issue. See the screenshots below:

My faulty project

Above is what the project tree looks like now.

correct project

Above is another project tree from a project which is working correctly. I want both to look like this. (The faulty project used to look like this.)

  • I once had similar issue. I deleted the intermediate folder and restarted android studio is worked fine for me. – Umair Sep 12 '17 at 09:14
  • did you try invalidating cache and restarting android studio? – Suraj Rao Sep 12 '17 at 09:15
  • I actually found a solution by accident only a few minutes after posting. What I did was: Click 'File -> Project Structure' then change the Compile Sdk Version. I had changed it to API 21 earlier without knowing what I was doing. Now I changed it back to API 25, and suddenly it started working. Still have no idea how or why, but it works. –  Sep 12 '17 at 09:19

4 Answers4

0

Cannot Resolve Symbol 'R' is a common error and most often, the cause is a malformed XML file.

Check your layouts, menus etc for anything that should not be there. It could be as simple as you accidentally typing a random character into one of the files or an invalid String.

Once the build completes normally, the other errors usually go away.

Many more options are listed in this question.

"cannot resolve symbol R" in Android Studio

Edit:

Choose Android View from the menu indicated.

Project View

Kuffs
  • 35,581
  • 10
  • 79
  • 92
  • The original problem was solved, but a new problem arised. I edited my original post and added screenshots. Could you take a look at it, please? –  Sep 12 '17 at 11:03
0

I imagine that's a bad thing..

Not necessarily, don't worry.

You can try to:

  1. Rrebuild your project in Android studio.
  2. From command line run gradlew clean assembleDebug and check output.
  3. Verify you are using compatible versions, check this post.
Manza
  • 3,427
  • 4
  • 36
  • 57
0

Clean your project doing this

Build > Clean Project or Build > Rebuild Project

Elinor
  • 101
  • 3
0

Possible solutions.

  1. Check resources and xml files.
  2. In android studio File-> Invalidate Caches / Restart
  3. Clean project.
  4. Delete .gradle from C:\%USERPROFILE%.gradle.
  5. Delete .gradle .idea and build files from your project.
Krunal Kapadiya
  • 2,853
  • 3
  • 16
  • 37