我使用Android Studio在手机上运行我的应用程序,运行正常.但应用程序本身从未安装过……
菜单中没有图标.每当我想测试我的应用程序时,我都必须“运行”.我没有错.
我相信我的清单存在问题.我在这做错了什么?:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jb854.eda.kent.ac.uk.edanews">
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".EDANewsApplication"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".activity.MainActivity"
android:windowSoftInputMode="adjustResize">
<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:scheme="http" android:host="www.eda.kent.ac.uk" android:pathPrefix="/school/"/>
</intent-filter>
</activity>
<activity
android:name=".activity.CommentsActivity"
android:theme="@style/AppTheme.TransparentActivity" />
<activity
android:name=".activity.ArticleActivity"
android:theme="@style/AppTheme.TransparentActivity" />
<activity
android:name=".activity.FullscreenImageActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_fullscreen_image"
android:theme="@style/AppTheme.TransparentActivity" />
<activity
android:name=".activity.FavouritesActivity"
android:label="@string/title_activity_favourites"
android:theme="@style/AppTheme.TransparentActivity" />
</application>
</manifest>
解决方法:
您应该为您的MainActivity添加类别LAUNCHER和操作MAIN:
<activity
android:name=".activity.MainActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.LAUNCHER"/>
<data android:scheme="http" android:host="www.eda.kent.ac.uk" android:pathPrefix="/school/"/>
</intent-filter>
</activity>