英文:
Android APK installs but can't be found on device
问题 {#heading}
我已经通过Android Studio构建了一个应用程序。构建成功。我已成功创建了一个APK文件。它已签名。
我已经将APK下载到我的设备上。它被找到并成功解压缩。我得到了"安装"的提示,然后安装成功。
然而,只有"完成"按钮是激活的,"打开"按钮被禁用。
当我在我的设备图标上查找应用程序(不仅仅是主屏幕)时,它不在那里。如果我打开"设置" > "应用程序",它在那里。
发生了什么?如果它已损坏,那么它不会构建,或者启动失败,但这同时安装和未安装。
谢谢。
编辑:为了明确,我在"设置" > "应用程序"中看到应用程序,它显示已安装,但如果我在手机上搜索应用程序,找不到它。
AndroidManifest如下(这是从新项目构建的):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ts_icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:targetApi="31">
<activity
android:name=".MainActivity" />
</application>
</manifest>
感谢大家 - 我不知怎么地丢失了我的清单文件的Launcher部分。下面是工作版本:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<application>
<activity
android:name=".MainActivity"
android:allowBackup="true"
android:exported="true"
android:icon="@mipmap/ts_icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:targetApi="31">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
英文:
I have built an app via Android Studio. The build is successful. I have created an APK file successfully. It is signed.
I have downloaded the APK to my device. It is found and unpacks successfully. I get the 'install anyway' prompt and it installs.
However, only the Done button is active, the Open button is disabled.
When I look for the app on my device icons (all screens not just home) it is not there. If I open Settings > Apps it is there.
What is going on? Surely if if is corrupt it wouldn't build or it would fail to launch but this is both installed and not installed at the same time.
Thanks.
EDIT: To be clear, in Settings > Apps I see the app and it says Installed but if I search for the app on my phone it is not found.
AndroidManifest as follows (this was built from new project):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
\<uses-permission android:name=\"android.permission.INTERNET\" /\>
\<application
android:allowBackup=\"true\"
android:icon=\"@mipmap/ts_icon\"
android:label=\"@string/app_name\"
android:roundIcon=\"@mipmap/ic_launcher\"
android:supportsRtl=\"true\"
android:theme=\"@style/AppTheme\"
tools:targetApi=\"31\"\>
\<activity
android:name=\".MainActivity\" /\>
`</application>
`
</manifest>
Thanks everyone - I somehow lost my Launcher section of my Manifest. Working version below.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
\<uses-permission android:name=\"android.permission.INTERNET\" /\>
\<application\>
\<activity
android:name=\".MainActivity\"
android:allowBackup=\"true\"
android:exported=\"true\"
android:icon=\"@mipmap/ts_icon\"
android:label=\"@string/app_name\"
android:roundIcon=\"@mipmap/ic_launcher\"
android:supportsRtl=\"true\"
android:theme=\"@style/AppTheme\"
tools:targetApi=\"31\"\>
\<intent-filter\>
\<action android:name=\"android.intent.action.MAIN\" /\>
\<category
android:name=\"android.intent.category.LAUNCHER\" /\>
\</intent-filter\>
\</activity\>
\</application\>
`</manifest>
`
答案1 {#1}
得分: 0
确保您拥有一个启动活动,从该活动中启动WebView。
您的清单应包含类似于以下内容的内容。
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.appName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
英文:
Make sure you have a launcher activity from where you are going to launch the webview.
Your manifest should contain something similar to this.
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Theme.appName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
答案2 {#2}
得分: 0
"An application intended to run on TV devices must declare a launcher activity for TV in its manifest. It uses a CATEGORY_LEANBACK_LAUNCHER intent filter to do this. This filter identifies your app as being enabled for TV and lets Google Play identify it as a TV app. When a user selects your app on their TV home screen, this intent identifies which activity to launch.
If you are building your app to run on TV devices as well, you should add the intent-filter to the activity:
If you don't include the CATEGORY_LEANBACK_LAUNCHER intent filter in your app, it's not visible to users running Google Play on TV devices. Also, if your app doesn't have this filter when you use developer tools to load it onto a TV device, the app does not appear in the TV user interface.
An application intended to run on TV devices must declare a launcher activity for TV in its manifest. It uses a CATEGORY_LEANBACK_LAUNCHER intent filter to do this. This filter identifies your app as being enabled for TV and lets Google Play identify it as a TV app. When a user selects your app on their TV home screen, this intent identifies which activity to launch.
If you are building your app to run in TV devices as well, you should add the intent-filter to the activity:
<activity
android:name="com.example.android.TvActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Leanback">
`<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
`
If you don't include the CATEGORY_LEANBACK_LAUNCHER intent filter in your app, it's not visible to users running Google Play on TV devices. Also, if your app doesn't have this filter when you use developer tools to load it onto a TV device, the app does not appear in the TV user interface.
https://developer.android.com/training/tv/start/start