The following error occurred while testing an activity:
(1) This is generally because this activity is not launcher activity
, nor is it set to Android: exported = "true"
*The activity as the startup page in Android must be set to intent filter or exported in mainfest
Solution: you can set Android: exported = "true"
on the activity configuration in androidmanifest.xml, or set intent filter
As follows:
<!-- activity Set exported as true -->
<activity android:name=".activity.POStockInActivity" android:exported="true"/>
<!-- activity set intent-filter -->
<activity android:name=".activity.LoginActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
(2) In another case, after modifying launcher activity
, run it directly with the shortcut key Shift + F10
, which will continue to run with the previous activity
Solution: do not use shortcut keys to start. Right-click the newly set activity and click ‘run xxxactivity’ to run it
*The following figure shows how to modify the launcher activity. You can see that after modifying the launcher activity, you will be warned. You need to set this activity to exported or set intent filter:
Similar Posts:
- [Solved] Android Studio Warning: Default Activity not found
- Android Studio 3 Error Message: The activity must be exported or contain an intent-filter
- The newly created androidmanifesto app is not indexable by Google search;
- java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.ba.cal
- Service Intent must be explicit solution: continued
- [Five Method to Solve] android webpage err_unknown_url_scheme
- Kotlin Viewpager+fragment error: java.lang.IllegalStateException: Fragment already added
- Android didi 16: a possibility of unable to start service intent
- Android studio reports an error using startservice: IllegalStateException
- Android – Unable to add window — token null is not for an application [How to Solve]