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 Build a Simple Android App (2014) Basic Android Programming Accessing Views in Code

No R file

For some reason no R file was generated waiting the r folder. Not sure why or what to do to fix this.

6 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Cody;

It look like you need to give it an actual id. Not knowing which element you are dealing with I can't give you a specific name, but the ones I used were textView, factTextView, or showFactButton depending on which element it was.

Try putting a id name in that field after the @+id/ and report back.

Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Cody;

I get those errors from time to time as well. I have had decent success doing a project clean and rebuild.

Post back if you are still stuck.

Ken

I attempted to rebuild but I got another error which reads:

Error:(11, 17) Execution failed for task ':app:processDebugResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /Applications/Android Studio.app/sdk/platforms/android-19/android.jar -M /Users/codybarrus/AndroidStudioProjects/FunFacts/app/build/intermediates/manifests/debug/AndroidManifest.xml -S /Users/codybarrus/AndroidStudioProjects/FunFacts/app/build/intermediates/res/debug -A /Users/codybarrus/AndroidStudioProjects/FunFacts/app/build/intermediates/assets/debug -m -J /Users/codybarrus/AndroidStudioProjects/FunFacts/app/build/generated/source/r/debug -F /Users/codybarrus/AndroidStudioProjects/FunFacts/app/build/intermediates/libs/app-debug.ap_ --debug-mode --custom-package com.awayandaway.funfacts -0 apk Error Code: 1 Output: /Users/codybarrus/AndroidStudioProjects/FunFacts/app/build/intermediates/res/debug/layout/activity_fun_facts.xml:1: error: Error: Resource id cannot be an empty string (at 'id' with value '@+id/').

Ken Alger
Ken Alger
Treehouse Teacher

Do you have any empty android:id properties in your activity_fun_facts.xml files?

Ken

this is what I have: android:id="@+id/"

It was somehow generated in the relative layout section. I just deleted it and rebuilt it and now it seems to be working. Thanks for your help.

Ken Alger
Ken Alger
Treehouse Teacher

You bet. Pleased it worked out.

Happy coding,

Ken

Andrei Brasoveanu
Andrei Brasoveanu
234 Points

Hey, i have a similar problem. In the new updated version of Android Studio there is no "build" folder at all, so i cannot find an "R" file.

Erik Russell
Erik Russell
1,032 Points

I am having this issue as well. If somebody could please advise that would be nice.