Android APK安装成功,但在设备上找不到。

huangapple go评论200阅读模式
英文:

Android APK installs but can't be found on device

问题

我已经通过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):

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;

&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;

&lt;application
    android:allowBackup=&quot;true&quot;
    android:icon=&quot;@mipmap/ts_icon&quot;
    android:label=&quot;@string/app_name&quot;
    android:roundIcon=&quot;@mipmap/ic_launcher&quot;
    android:supportsRtl=&quot;true&quot;
    android:theme=&quot;@style/AppTheme&quot;
    tools:targetApi=&quot;31&quot;&gt;
    &lt;activity
        android:name=&quot;.MainActivity&quot; /&gt;


&lt;/application&gt;

</manifest>

Thanks everyone - I somehow lost my Launcher section of my Manifest. Working version below.

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;

&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
&lt;application&gt;
&lt;activity
    android:name=&quot;.MainActivity&quot;
    android:allowBackup=&quot;true&quot;
    android:exported=&quot;true&quot;
    android:icon=&quot;@mipmap/ts_icon&quot;
    android:label=&quot;@string/app_name&quot;
    android:roundIcon=&quot;@mipmap/ic_launcher&quot;
    android:supportsRtl=&quot;true&quot;
    android:theme=&quot;@style/AppTheme&quot;
    tools:targetApi=&quot;31&quot;&gt;
        &lt;intent-filter&gt;
            &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
            &lt;category
                android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
        &lt;/intent-filter&gt;
&lt;/activity&gt;
&lt;/application&gt;

&lt;/manifest&gt;

答案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.

&lt;activity
            android:name=&quot;.MainActivity&quot;
            android:exported=&quot;true&quot;
            android:label=&quot;@string/app_name&quot;
            android:screenOrientation=&quot;portrait&quot;
            android:theme=&quot;@style/Theme.appName&quot;&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                &lt;category           
                 android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

答案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.

Link to more information"

英文:

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:

&lt;activity
android:name=&quot;com.example.android.TvActivity&quot;
android:label=&quot;@string/app_name&quot;
android:theme=&quot;@style/Theme.Leanback&quot;&gt;

&lt;intent-filter&gt;
  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  &lt;category android:name=&quot;android.intent.category.LEANBACK_LAUNCHER&quot; /&gt;
&lt;/intent-filter&gt;
&lt;/activity&gt;

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

huangapple
  • 本文由 发表于 2023年8月11日 02:03:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76878276.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定