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 Self-Destructing Message Android App Starting the App Navigation with Back and Up

Carney Bernard
Carney Bernard
3,615 Points

Error in Android Studio- Emulator not running

I have been following along closely to Ben's videos and I am getting a run error on Android Studio. First the app wouldn't run, then I checked 'Select Run/Debug Configuration' button and there was a big red X on the Android icon. When I clicked on the edit configurations window there is and error that says 'Error- Default Activity Not Found.' Also whenever I try to run the app the edit configurations tab comes up instead of the AVD Manager. This particular instance is very odd because this has never happened before and AS was working fine yesterday.

Thanks

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Carney;

Generally speaking a "Error - Default Activity Not Found" error would indicate that there is an issue in your AndroidManifest.xml file and there being an issue with an activity not being declared properly as the Main and/or Launcher activity.

Can you post your manifest code here on the forum?

Ken

Ken Alger
Ken Alger
Treehouse Teacher

You may try the following steps as well:

  1. Build -> Rebuild Project
  2. File -> Invalidate Caches.. -> Invalidate and restart Depending on your version of Android Studio it may just be Invalidate and restart

Ken

Carney Bernard
Carney Bernard
3,615 Points

Ken thanks for your response!

Here is my manifest.xml file:

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

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".LoginActivity"
            android:label="@string/title_activity_login"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name=".SignUpActivity"
            android:label="@string/title_activity_sign_up"
            android:parentActivityName="carneybernard.ribbit.LoginActivity"
            android:screenOrientation="portrait">
        </activity>


</manifest>
Carney Bernard
Carney Bernard
3,615 Points

I just tried did both steps and no luck at all either, it really is out of the ordinary

Ken Alger
Ken Alger
Treehouse Teacher

Did you do a project clean as well prior to the rebuild? Not certain that will fix things, but try to clean and then rebuild. Also I have found that restarting Android Studio, at times, clears a few random "undocumented features" up.

Let me do some additional thinking/research on this and if your still stuck post back and when I return this evening I'll take another look at the situation.

Are there any additional errors that come up?

Ken

Carney Bernard
Carney Bernard
3,615 Points

Thank you so much Ken!

But, yes, I did clean the project prior to rebuilding it. I also restarted Android Studio. I also looked on Stack Overflow for a few answers and nothing has worked out. I'm thinking I may just have to put my projects up on GitHub and reinstall Android Studio.

Umy Ikem
Umy Ikem
21,383 Points

hello Ken,

i have exactly the same problem as Carney stated here, and i have followed all of the steps and tips that you provided here, all to no avail.

i was wondering if you eventually did come up with a successful solution to the problem. it would be very much appreciated. Below is a copy of my manifest sheet.

thanks

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

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".StoryActivity"
            android:label="@string/title_activity_story"
            android:parentActivityName="com.example.didi.interactivestory.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.didi.interactivestory.MainActivity" />
        </activity>
    </application>

</manifest>
Ken Alger
Ken Alger
Treehouse Teacher

Umy;

Your manifest file looks fine, the only differences between yours and mine are some of the activity names and their respective locations. For example, I have MainActivity in a ui package so that activity information is android:name=".ui.MainActivity" It looks like you have renamed a few things as well as I do not have an .InteractiveStory in my project.

If you, or Carney Bernard have your projects posted on Git Hub, post a link to the repo and I can see if I can work on them on my end. With renamed files it can be a challenge to debug in situations like this not knowing what your version on a file is called, etc.

Happy coding,

Ken