Default Activity not found in Android Studio

后端 未结 28 1137
盖世英雄少女心
盖世英雄少女心 2020-11-29 03:22

I just upgraded to Android Studio 0.2.8 and I am getting an error that says \"Default Activity not found\" when I try to edit the run configurations.

When I launch A

相关标签:
28条回答
  • 2020-11-29 03:32

    I figured it out. I mistakenly added final keyword in activity declaration. Once I removed it everything works!

    public  class SplashActivity extends AppCompatActivity {
    ...
    }
    
    0 讨论(0)
  • 2020-11-29 03:36

    If you don't have the tab and you started with an empty activity try this. Below is a sample code example:

    <application android:label="@string/app_name">
    
        <activity android:name=".HelloActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    
    </application>
    

    Now go to your AndroidManifest.xml file. Next copy the intent filter from this code. Look at your manifest file really good and paste the intent filter in the exact place it is in the code above. (after the .yourActivityName> part of the manifest.) I hope this helped.

    0 讨论(0)
  • 2020-11-29 03:36

    Check if there is any duplicate tag in your AndroidManifest.xml file.

    0 讨论(0)
  • 2020-11-29 03:37

    Have you added ACTION_MAIN intent filter to your main activity? If you don't add this, then android won't know which activity to launch as the main activity.

    ex:

    <intent-filter>
          <action android:name="android.intent.action.MAIN"/>
          <action android:name="com.package.name.MyActivity"/>
          <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    
    0 讨论(0)
  • 2020-11-29 03:37

    Please make sure in manifest that package name is same with your main activity

    0 讨论(0)
  • 2020-11-29 03:39

    In my case, it worked when I removed the .idea folder from the project (Project/.ida) and re-opened Android Studio again.

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