How to solve error “Default Activity Not Found” occurred when starting my application from Service?

后端 未结 3 1622
误落风尘
误落风尘 2021-01-16 11:33

I need to start my Android Application using Service and after start an Activity from that Service. First

相关标签:
3条回答
  • 2021-01-16 11:58

    Put this in your Activity in manifest

     <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
    
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    
    0 讨论(0)
  • 2021-01-16 12:12

    android.intent.action.MAIN means that this activity is the entry point of the application, i.e. when you launch the application, this activity is created.

    android.intent.category.LAUNCHER says that entry point should be listed in the application launcher

    So you need to add that in your manifest. Just change:

    <activity android:name=".MainActivity"></activity>
    

    to

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    
    0 讨论(0)
  • 2021-01-16 12:15

    Please refer below link. I hope this helps

    https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0ahUKEwjsytHAhLLXAhWDuo8KHa4kAjoQFgg2MAM&url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F15825081%2Ferror-default-activity-not-found&usg=AOvVaw0HThKZRxKk9ET-NdnVwEfR

    0 讨论(0)
提交回复
热议问题