An error occurred while performing the second action. Activity must be exported or contain an intent filter

I can not start the application. This gives me this error: "Error while performing the second action: the action must be exported or contain an intent filter."

Is there something wrong with my manifest?

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="sg.edu.rp.g913.mymakeuppouch"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" 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=".secondActivity"> </activity> </application> </manifest> 
+6
source share
3 answers

Put android:exported="true" in the <activity>

 <activity android:name=".secondActivity" android:exported="true"> 
+24
source

You must set Run> Edit Configuration to the desired launch activity and give the intent filter the correct activity in the manifest.

below is the situation creating the error.

 <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" 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=".Page_2"> </activity> </application> 

Incorrect configuration image

the correct configuration and code is given below to launch Mainactivity as launch activity

 <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" 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=".Page_2"> </activity> </application> 

adjusted configuration window

+4
source
  1. Go to the Run menu and select Change Configuration.
  2. In the widows of the run / debug configuration, select your application in the left column (if it is not already selected).
  3. under the launch option: start, press the side arrow and select the “specified action” option.
  4. enter the name of the action with which you want to launch your applications, or the tab on the side button (...) and select from your actions.
0
source

Source: https://habr.com/ru/post/1259406/


All Articles