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

Daniel Scheiter
Daniel Scheiter
8,794 Points

Problem with weather app

I have been working on making stormy location awareness when I started having problems referencing R and the drawables I put it on Github here: https://github.com/Mistika/Cloudy/tree/master I am not finished with the location awareness so if you see any major problems or where the code is not finished I will probably get to it eventually. This also my first time with Github So any advice on that would help to.

Seth Kroger
Seth Kroger
56,413 Points

FYI, you can share the entire project in Android Studio in one step by using VCS -> Import Into Version Control -> Share Project on GitHub from the menu. You just need to enter your account info into settings.

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

When you refer to a drawable you should only refer to the name of the drawable without specifying the resolution or file type. Android will figure those out for you. So '@drawable/drawable-hdpi/degree.png' should be just '@drawable/degree', etc. This goes for any @/R. resource that can have different variations like screen resolutions, languages, orientations, etc.

Daniel Scheiter
Daniel Scheiter
8,794 Points

I changed every thing so it can reference those now but am still having trouble with the icon:
Error:(23, 23) No resource found that matches the given name (at 'icon' with value '@drawable/drawable- hdpi/ic_launcher'). and it reverts back to that even if I change it.

Seth Kroger
Seth Kroger
56,413 Points

That's in AndroidManifest, right? it shouldn't revert to anything if you edit it.

Daniel Scheiter
Daniel Scheiter
8,794 Points

No, it is in the activity_main oddly enough.

Seth Kroger
Seth Kroger
56,413 Points

There should be a line in the manifest specifying the launcher icon. That one needs to be fixed too.

Seth Kroger
Seth Kroger
56,413 Points

Problems with R usually clear up with a Clean and Rebuild.

Daniel Scheiter
Daniel Scheiter
8,794 Points

When I rebuild or clean it errors out saying this:
Error:(33, 14) No resource found that matches the given name (at 'src' with value '@drawable/drawable-hdpi/degree.png'). Error:(64, 14) No resource found that matches the given name (at 'src' with value '@drawable/drawable-hdpi/cloudy_night.png'). Error:(143, 14) No resource found that matches the given name (at 'src' with value '@drawable/drawable-hdpi/refresh.png'). Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/Me/Library/Android/sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1 Information:BUILD FAILED Information:Total time: 14.232 secs Information:4 errors