Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Cannot resolve symbol 'R' error

When changing the .png file for the image I wouldn't get the new image to show up, I just kept seeing the default app image. So I saw a Clean and Rebuild was recommended so I gave it a try. This resulted in an error with "R" any help would be appreciated.

The error message from Gradle Build:

Error:(13, 23) No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher'). Error:(13, 23) Execution failed for task ':app:processDebugResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\Tommy\Documents\android-studio\sdk\build-tools\android-4.4W\aapt.exe package -f --no-crunch -I C:\Users\Tommy\Documents\android-studio\sdk\platforms\android-19\android.jar -M C:\Users\Tommy\AndroidStudioProjects\FunFacts\app\build\intermediates\manifests\debug\AndroidManifest.xml -S C:\Users\Tommy\AndroidStudioProjects\FunFacts\app\build\intermediates\res\debug -A C:\Users\Tommy\AndroidStudioProjects\FunFacts\app\build\intermediates\assets\debug -m -J C:\Users\Tommy\AndroidStudioProjects\FunFacts\app\build\generated\source\r\debug -F C:\Users\Tommy\AndroidStudioProjects\FunFacts\app\build\intermediates\libs\app-debug.ap_ --debug-mode --custom-package com.example.tommy.funfacts -0 apk Error Code: 1 Output: C:\Users\Tommy\AndroidStudioProjects\FunFacts\app\build\intermediates\manifests\debug\AndroidManifest.xml:11: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').

Here is my code from FunFactsActivity.java

http://imgur.com/EBaeFak

1 Answer

Hello,

Current versions of Android studio store their icons(and only icons) in a folder called mipmap now. So to reference the launcher icon it would need to be converted to @mipmap/ic_launcher in your AndroidManifest.xml file. Also double check to make sure ic_launcher.png exists.