简体   繁体   English

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

[英]Icon missing in installed app?

So I have been working on a basic android application but when ever I load it on the emulator it used to work but now the icon is simply not there its not installed the application. 因此,我一直在开发基本的android应用程序,但是每当我将其加载到模拟器上时,它就可以正常工作,但是现在图标根本就没有安装该应用程序。 I have tried all version of the Android this did not fix the issue. 我已经尝试了所有版本的Android,但均未解决问题。 I tried using my own Android device it worked for 3 days and then it simply stopped working as well. 我尝试使用自己的Android设备运行了3天,然后又停止运行。 So each time I compile the code it works but the application is not installed on any device what so ever. 因此,每次我编译代码都可以,但是应用程序却没有安装在任何设备上。 So far I tried factor reset phone, Reinstall Android Studio and Different Emulator version nothing worked. 到目前为止,我尝试了因子重置电话,重新安装Android Studio和其他模拟器版本均无效。

Any ideas or solutions? 有什么想法或解决方案吗?

Manifest : 清单

<?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>

Compiler output : 编译器输出

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

I think your issue is you changed something in the manifest between the app working and its current state. 我认为您的问题是您更改了应用程序正常运行和当前状态之间的清单中的某些内容。 As a disclaimer, I'm not an Android specialist but something jumps out at me right away in terms of my experience - you don't have a launcher category defined for any of your activities. 作为免责声明,我不是Android专家,但是根据我的经验,我会立即想到一些问题-您没有为任何活动定义启动器类别。

From the Android Intent documentation (emphasis mine): Android Intent文档 (重点是我的):

Intents are matched against intent filters not only to discover a target component to activate, but also to discover something about the set of components on the device. 将意图与意图过滤器进行匹配,不仅可以发现要激活的目标组件,还可以发现有关设备上的组件集的某些信息。 For example, the Home app populates the app launcher by finding all the activities with intent filters that specify the ACTION_MAIN action and CATEGORY_LAUNCHER category . 例如,“首页”应用通过查找所有具有指定ACTION_MAIN操作和CATEGORY_LAUNCHER类别的意图过滤器的活动来填充应用启动器

This is what you're missing in your manifest; 这就是清单中所缺少的; a LAUNCHER . LAUNCHER

In every app I've made there was one; 在我制作的每个应用程序中,都有一个。 I just altered the manifest of the current app I'm working on to reflect a DEFAULT for my launcher activity, and it broke. 我只是更改了我正在开发的当前应用程序的清单,以反映启动器活动的DEFAULT ,但该应用程序DEFAULT了。

So, in your manifest you have... 因此,您的清单中有...

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

I think you should "match" your intents and do... 我认为您应该“匹配”您的意图并执行...

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

instead. 代替。

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

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