码迷,mamicode.com
首页 > 其他好文 > 详细

Error处理: 重提No Launcher activity found!

时间:2017-07-23 16:40:44      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:required   提示   raw   tag   min   sso   launcher   应用   pre   

Error处理: 重提No Launcher activity found!


重提No Launcher activity found!错误提示,及解决的方法


Android应用开发中No Launcher activity found! 是常见的错误,并且解决的方法也非常easy。

做Android开发已经非常久了,相信自己不会轻易犯这个错误,可是今天却又遇到。在AndroidManifest.xml文件里也非常确定的已经加入了

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

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

问题在那里那?


先看详细代码吧

AndroidManifest.xml文件内容例如以下:

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

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.NFC" />

    <uses-feature
        android:name="android.hardware.nfc"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.app.test.MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />


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

                <action android:name="android.nfc.action.TAG_DISCOVERED" />
            </intent-filter>
        </activity>
    </application>

</manifest>

执行时console中信息例如以下:

技术分享

执行了多次均如此,也没发现什么情况造成的。

在实验多次之后,发现将AndroidManifest.xml做例如以下调整就可以。

调整后的AndroidManifest.xml文件内容例如以下:

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

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.NFC" />

    <uses-feature
        android:name="android.hardware.nfc"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="mexxen.app.test.MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />


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

</manifest>


执行效果例如以下:

技术分享


结论:


在指定启动主界面的Activity时。尽量不要把不相干的action以及category与LAUNCHER放在一个 <intent-filter>中。



----------------------------------

欢迎浏览、技术交流
请尊重劳动成果
转载请注明出处。谢谢。
http://blog.csdn.net/netwalk/article/details/35289751






Error处理: 重提No Launcher activity found!

标签:required   提示   raw   tag   min   sso   launcher   应用   pre   

原文地址:http://www.cnblogs.com/liguangsunls/p/7224881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!