未启动默认活动启动活动时出错

时间:2017-03-03 06:41:28

标签: java android manifest default main-activity

错误 enter image description here

03/02 22:01:22:启动应用程序 没有本地更改,没有部署APK 无法识别启动活动:找不到默认活动 启动活动时出错

这是我的AndroidManifist.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.rehankhan.teachercourse">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <!-- permission required to use Alarm Manager -->
        <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
        <uses-feature android:name="android.hardware.sensor.stepcounter" />
        <uses-feature android:name="android.hardware.sensor.stepdetector" />

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".SignUP" />
        <activity android:name=".T_TimeTABLE" />
        <activity android:name=".Parent_MAin" />
        <activity android:name=".attendenceSheet" />
        <activity android:name=".Review_from_teacher" />
        <activity android:name=".welcom" />
        <activity android:name=".Student_MAin" />
        <activity
            android:name=".Fine_attendence"
            android:label="@string/title_activity_fine_attendence"
            android:theme="@style/AppTheme.NoActionBar" />

        <service android:name=".NotifyService" />
        <service android:name=".step_counter"/>

        <activity android:name=".gps" />
        <activity android:name=".course_of_review" />
        <activity android:name=".Teacher_MAP"></activity>
        <activity android:name=".std_course_review"></activity>
    </application>

</manifest>

** Gradle文件**

apply plugin: 'com.android.application'
android {
  compileSdkVersion 23
  buildToolsVersion "23.0.3"

  defaultConfig {
      applicationId "com.example.rehankhan.teachercourse"
      minSdkVersion 15
      targetSdkVersion 23
      versionCode 1
      versionName "1.0"
      multiDexEnabled true

  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }
}

2 个答案:

答案 0 :(得分:1)

更改您的意图过滤器,如下所示

<intent-filter>
    <action android:name="android.intent.action.MAIN"/>

    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

您已添加action两次而不是category

答案 1 :(得分:0)

试试这个,

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

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- permission required to use Alarm Manager -->
        <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
        <uses-feature android:name="android.hardware.sensor.stepcounter" />
        <uses-feature android:name="android.hardware.sensor.stepdetector" />

    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />


        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
        </activity>

        <activity android:name=".SignUP" />
        <activity android:name=".T_TimeTABLE" />
        <activity android:name=".Parent_MAin" />
        <activity android:name=".attendenceSheet" />
        <activity android:name=".Review_from_teacher" />
        <activity android:name=".welcom" />
        <activity android:name=".Student_MAin" />
        <activity
            android:name=".Fine_attendence"
            android:label="@string/title_activity_fine_attendence"
            android:theme="@style/AppTheme.NoActionBar" />

        <service android:name=".NotifyService" />
        <service android:name=".step_counter"/>

        <activity android:name=".gps" />
        <activity android:name=".course_of_review" />
        <activity android:name=".Teacher_MAP"></activity>
        <activity android:name=".std_course_review"></activity>
    </application>
    </manifest>