Error running app: Default Activity not found error

Keywords: Android Attribute xml encoding

Today, in compiling Android project files, because other project code is moved to compile under the project, so compiled a problem, reported Error running app: Default Activity not found error.
One way to search online is to select Launch Options in the General directory and Nothing in Edit Configurations, but app does not run in the compiled simulator. So keep looking for methods and finally find them on stack overflow. The problem is located in the Android Manifest. XML file, and pay attention to viewing your own file. My own is as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.zhuzhixiong.uibestpractice">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

    </application>

</manifest>

The amendments are as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.zhuzhixiong.uibestpractice">

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

</manifest>

After adding activity, the compiler can run successfully.

Posted by teebo on Mon, 04 Feb 2019 07:21:16 -0800