繁体   English   中英

安装的应用程序中缺少图标?

[英]Icon missing in installed app?

因此,我一直在开发基本的android应用程序,但是每当我将其加载到模拟器上时,它就可以正常工作,但是现在图标根本就没有安装该应用程序。 我已经尝试了所有版本的Android,但均未解决问题。 我尝试使用自己的Android设备运行了3天,然后又停止运行。 因此,每次我编译代码都可以,但是应用程序却没有安装在任何设备上。 到目前为止,我尝试了因子重置电话,重新安装Android Studio和其他模拟器版本均无效。

有什么想法或解决方案吗?

清单

<?xml version="1.0" encoding="utf-8"?>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".Splash"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.example.edgaraxelsson.myapplication.STARTINGPOINT" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Menu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.example.edgaraxelsson.myapplication.MENU" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Text"
        android:label="@string/app_name" >

    </activity>
</application>

编译器输出

Testing started at 10:19 ...
Waiting for device.
Target device: samsung-sm_g900f-cd9e70da
Uploading file
    local path: C:\Users\Edgar Axelsson\AndroidStudioProjects\MyApplication2\app\build\outputs\apk\app-debug.apk
    remote path: /data/local/tmp/com.example.edgaraxelsson.myapplication
No apk changes detected. Skipping file upload.
Uploading file
    local path: C:\Users\Edgar Axelsson\AndroidStudioProjects\MyApplication2\app\build\outputs\apk\app-debug-test-unaligned.apk
    remote path: /data/local/tmp/com.example.edgaraxelsson.myapplication.test
No apk changes detected. Skipping file upload.
Running tests
Test running startedFinish

我认为您的问题是您更改了应用程序正常运行和当前状态之间的清单中的某些内容。 作为免责声明,我不是Android专家,但是根据我的经验,我会立即想到一些问题-您没有为任何活动定义启动器类别。

Android Intent文档 (重点是我的):

将意图与意图过滤器进行匹配,不仅可以发现要激活的目标组件,还可以发现有关设备上的组件集的某些信息。 例如,“首页”应用通过查找所有具有指定ACTION_MAIN操作和CATEGORY_LAUNCHER类别的意图过滤器的活动来填充应用启动器

这就是清单中所缺少的; LAUNCHER

在我制作的每个应用程序中,都有一个。 我只是更改了我正在开发的当前应用程序的清单,以反映启动器活动的DEFAULT ,但该应用程序DEFAULT了。

因此,您的清单中有...

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.DEFAULT" />
    ...

我认为您应该“匹配”您的意图并执行...

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    ...

代替。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM