Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

Adam Rubin
Adam Rubin
6,692 Points

Unresolved class StoryActivity, and cannot resolve symbol R

I just got these two errors after adding details in the Creating the Story Layout video. The app still runs! I'm not sure how much this actually affects the project. I believe the package lines are correct, so I'm not sure why the xml files can't find the StoryActivity.

I'm unsure how to post code in the fancy box, but for now here it is:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.adamprojects.interativestory.ui.StoryActivity">

And the last line is the unresolved class. I'm aware of the 'interative' typo, and it's in all my files, so I don't believe that's the problem - but if you know a simple way to change all of those, I'd love to learn it!

This is also happening in the AndroidManifest.xml file, for both MainActivity and StoryActivity

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.adamprojects.interativestory">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".StoryActivity"></activity>
    </application>

</manifest>

I am not sure how to fix it! Please let me know if you do.