Reputation: 51
My program is giving me the following error in Android Studio.
00:28 Error running app: Default Activity not found
I think the problem is in the AndroidManifest.xml
`
<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">
</activity>
</application>
` Can anyone help me please?
Upvotes: 0
Views: 1145
Reputation: 79
The easiest way to fix this is to increase your minimum API level to 16 so that it meets the requirements for 'parentActivityName'
To do this go into your build gradle. Look for the minSdkVersion and change it to 16.
It's at the top in android{ defaultConfig {} }
Afterward Resync Gradle
Upvotes: -1
Reputation: 1663
To correct the
android:parentActivityName is introduced in API 16
error, you should add this bloc of code for the activity that has a parent:
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.myapp.ui.MainActivity" />
Here is an example from one of my apps:
<activity
android:name="com.souf.prayTime.ui.AboutActivity"
android:label="@string/about"
android:parentActivityName="com.souf.prayTime.ui.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.souf.prayTime.ui.MainActivity" />
</activity>
Hope this will help ;)
Upvotes: 1
Reputation: 1006724
Default Activity not found
Your application has no <activity>
that will be launched by the home screen. That would need to have the appropriate <intent-filter>
, such as:
<activity android:name="MainActivity">
<!-- This activity is the main entry, should appear in app launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Also:
Attribute parentActivityName
is only used in API level 16 and higher (current min is 15)just means that your
android:parentActivityName` attribute will not have an effect on some devices that you are supporting
However, android:parentActivityName
is pointing to an activity (MainActivity
) that does not exist in your manifest
Upvotes: 2