【问题标题】:No lauch activity found未找到任何 lauch 活动
【发布时间】:2012-03-27 10:13:04
【问题描述】:

我的 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!

我已经检查了我的清单文件,但是有必要的 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>

【问题讨论】:

  • 请发布您的整个清单文件。
  • 您是否将 SDCARD 添加到您的模拟器中?

标签: android manifest launch


【解决方案1】:

您应该将操作拆分为多个意图过滤器。 喜欢:

        <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>

否则无法识别

【讨论】:

    【解决方案2】:

    为您的活动 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-27
      • 2013-02-04
      • 2019-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多