我使用 android studio 创建了一个 android 应用程序。当我在 IDE 上运行我的代码时,它在连接的手机上按预期运行。问题是,它不会在我的手机上留下一个图标供下次使用。我将再次必须从 android studio 运行才能使用该应用程序。最初很好,我不知道是什么让图标消失了。该应用程序也存在于设置中。 当我去
Settings->apps
我可以在那里很好地找到我的应用程序。它没有被禁用。我尝试卸载该应用程序并重试。它仍然没有给我图标。 我清除了默认值,强制关闭并尝试了所有可能的方法。没有任何帮助。
请帮忙。
我的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".TwitterLogin"
android:label="@string/title_activity_twitter_login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name=".NextActivity"
android:label="@string/title_activity_next" >
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="b1fe9f0c7d80c3c24879d634b199f2d0e474b4ba" />
<activity
android:name=".WebViewActivity"
android:label="@string/title_activity_web_view" >
</activity>
</application>
</manifest>
最佳答案
您应该为可以启动您的应用的每个 Intent 指定一个不同的。因此,一个用于包含您的 url 数据的 BROWSER 类别,一个用于 LAUNCHER 类别。
来自App Manifest指南。
Components advertise their capabilities — the kinds of intents they can respond to — through intent filters. Since the Android system must learn which intents a component can handle before it launches the component, intent filters are specified in the manifest as elements. A component may have any number of filters, each one describing a different capability.
你的代码会变成这样:
<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.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
</intent-filter>
关于android - 运行代码时应用程序图标不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29936139/