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

The Generated Resource Class does not show in my build folder.

I am on the Accessing views in code lesson and i am trying to declare a TextView. I have coded in "Textview factLabel - findViewById() and in the parameters I am being told to find a certain script which I cannot find. This link should explain which script it is http://awesomescreenshot.com/0b93dwh336.

I cannot find it on the Android Studio on my laptop and would love some help with this.

Thank you in advance.

4 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Are you getting any errors in Android Studio? That file is generated each time you build the project. Any errors in your code or when you build would prevent it from being generated. Reply here with screenshot of your whole Android Studio window if you can't find any errors.

Hi Ben,

So I ran the app and got an error. I cannot post it here because it is a screenshot on my actual laptop and I dont see an option to upload a file here.

The error says "Error:(11, 17) Resource id cannot be an empty string (at 'id' with value '@+id/')."

This corresponds with the relative layout part in my activity_functacts.xml document which has the following code with it>>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="40dp"
    android:paddingBottom="26dp"
    tools:context=".FunfactsActivity"
    android:background="#3079ab"
    android:id="@+id/"> 

<<<I think it corresponds to here. What will you suggest?

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Okay, cool. That's enough to pinpoint the error. Your instincts are correct! We talk about the IDs a little later in the project. You could delete the android:id line, but you'll need it later, so you may as well name it now. After the slash type something like "relativeLayout":

android:id="@+id/relativeLayout" 

Yup, got it. Works now.

Thank you Ben

Hey, have the same problem like the previous author described.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".FunFactsActivity"
android:background="@android:color/holo_blue_dark">
Ben Jakuben
Ben Jakuben
Treehouse Teacher

Can you paste in your whole layout file? This first part looks okay.