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) Creating the Screen Layout Getting to Know Our Tools

I need help clarifying an issue I am having with Android Studio.

Whenever I run the Fun Facts program and then launch the emulator I get the error

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.teamtreehouse.funfacts/.MainActivity } Error type 3 Error: Activity class {com.teamtreehouse.funfacts/com.teamtreehouse.funfacts.MainActivity} does not exist.

However I am not sure why this would happen. I did everything else correctly. Or so I thought.

5 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Can you post your AndroidManifest file as well as the package name of your MainActivity?

The Android Manifest is: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.teamtreehouse.funfacts" >

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

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

</manifest>

Package name: com.teamtreehouse.funfacts

Jon Kussmann
Jon Kussmann
Courses Plus Student 7,254 Points

Nothing is jumping out to me yet, could you also post your MainActivity code?

Absolutely, and thank you for your time as well! One moment.

ackage com.teamtreehouse.funfacts;

import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem;

public class MainActivity extends ActionBarActivity {

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

}

I feel as though the answer is extremely obvious but I just cannot figure it out.

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Your code looks fine to me.

In Android Studio:

Build -> Clean Project

Build -> Rebuild Project

Try running again. If that doesn't work, close and reopen Android Studio.

Jon Kussmann
Jon Kussmann
Courses Plus Student 7,254 Points

Also, do you have a physical device you can try running the app from?

I do not, I need to download Genymotion and try that but so far everything is running smoothly! I am going to follow along with the lessons and see if I run into any more trouble with the program.