未找到任何发布活动

时间:2012-03-27 10:13:05

标签: android manifest launch

我的Android应用程序存在问题。当我想在模拟器或真实设备上运行我的应用程序时出现错误:

[2012-03-27 12:01:30 - CallApp] Android Launch!
[2012-03-27 12:01:30 - CallApp] adb is running normally.
[2012-03-27 12:01:30 - CallApp] No Launcher activity found!
[2012-03-27 12:01:30 - CallApp] The launch will only sync the application package on the device!
[2012-03-27 12:01:30 - CallApp] Performing sync
[2012-03-27 12:01:30 - CallApp] Automatic Target Mode: Several compatible targets. Please select a target device.
[2012-03-27 12:01:32 - CallApp] Uploading CallApp.apk onto device 'emulator-5554'
[2012-03-27 12:01:33 - CallApp] Installing CallApp.apk...
[2012-03-27 12:01:36 - CallApp] Success!
[2012-03-27 12:01:36 - CallApp] \CallApp\bin\CallApp.apk installed on device
[2012-03-27 12:01:36 - CallApp] Done!

我已经检查了我的Manifest-File,但是有必要的Launcher和MAIN语句:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="de.CallApp.CallApp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.BATTERY_STATS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <receiver android:name=".receiver.BootBroadcastReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <receiver android:name=".receiver.SmsBroadcastReceiver" >
            <intent-filter android:priority="99999999" >
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>

        <activity
            android:name="de.CallApp.CallApp.CallAppActivity"
            android:configChanges="keyboardHidden|orientation"
            android:label="@string/app_name" >
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" />

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

                <action android:name="android.intent.action.ACTION_BATTERY_LOW" />
                <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
            </intent-filter>
        </activity>
    </application>

</manifest>

2 个答案:

答案 0 :(得分:1)

您应该将操作拆分为多个intent-filters。 像:

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

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

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

否则它不会被识别

答案 1 :(得分:0)

为您的活动 de.CallApp.CallApp.CallAppActivity 设置 intent过滤器,如下所示:

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

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

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