Android Error: The Activity Must be Exported or Contain an Intent-Filter
When you run the android application in the Android Studio and you face an error, The Activity Must be Exported or something like below.
Error running Dashboard: The activity must be exported or contain an intent-filter
There are possible solutions which can help in getting rid of the error.
Possible Solution 1
if you face The Activity Must be Exported error. First, you should double check the manifest code and look for below code.
1 2 3 |
<intent-filter> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> |
Your main activity must have this code inside the activity tag. It should look like
1 2 3 4 5 6 |
<activity android:name=".activityName"> <intent-filter> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> |
Possible Solution 2
if The Activity Must be Exported error doesn’t go away by following the solution 1 then follow solution 2.
There is a drop-down menu beside the Green Run (play) icon. Select the “app” from the drop-down and run your app again.
Coding in the android studio is not so hard but sometimes we face errors which really make us annoy but we try our best to get rid of the errors, sometimes it’s hard to find the solution to the problem or error.
Final Words for The Activity Must be Exported Error
If the problem still persists, and you’re not able to solve it, just let us know in the comment with the snap of code and little description that what you’re trying to do. We will try our best to get back to you as soon as possible.