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 an Interactive Story App (Retired) Finishing the User Interface Loading the First Page

My code is giving me an error saying"can't find symbol R"

Here is my code: package com.example.roshan.mystoryapp.ui;

import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import com.example.roshan.mystoryapp.R;

public class StoryActivity extends ActionBarActivity {

public static final String TAG = StoryActivity.class.getSimpleName();


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_story_activity2);

    Intent intent = getIntent();
    String name = intent.getStringExtra("name");
    if(name ==null) {
        name = "Friend";
    }
    Log.d(TAG,name);
}

}

2 Answers

Hello,

Could you try going to Build, then Clean Project? If that doesn't fix it, we can try some other troubleshooting methods.

No , it did not work by rebuilding the project.

Hello,

The only two immediate things i can think of other than cleaning the project are to either try to invalidate the caches in Android Studio or possibly that its complaining that you're layout isn't named activity_story_activity2.

Thanks, I got it!!

I thought I did but now it is giving me the same error again(I tied everything). Got any other ideas ? [Thanks]

I thought I did but now it is giving me the same error again(I tied everything). Got any other ideas ? [Thanks]