-1

Im trying to add upward navigation while following the beginners tutorial to android studio here. However, when I try to run it, it gives me the error:

Error running 'app':
Default Activity not found

The code in my AndroidManifest.xml file is:

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

<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=".DisplayMessageActivity"
        android:parentActivityName=".MainActivity">
        <!-- The meta-data tag is required if you support API level 15 and lower -->
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>

</application>

</manifest>
Onik
  • 19,396
  • 14
  • 68
  • 91
Qwertford
  • 1,039
  • 2
  • 14
  • 25

1 Answers1

0

There could be a number of things going on here. I would first suggest that you check all naming references to the layout and the code behind with a discerning eye. Sometimes with editing, you can inadvertently change and rename a file by adding or deleting letter in the name. Also, from time to time, when working with a IDE, a state of modification can go stale in which you can sometimes do a clean/build or a restart of the IDE. Pending updates to the IDE may be a culprit as well.

As a best practice, you should version your code. This will help alleviate most issues such as this. Check out the following link to Android's recommendations on this practice.

https://developer.android.com/studio/publish/versioning

Euler
  • 312
  • 1
  • 11