App icon doesn't show (Android Studio)

2019-02-20 14:43发布

问题:

This is my very first time to make an android application. I've only made 3 designs for my very first app but every time I ran the Android Virtual Device, the icon of my app doesn't show up (the application itself :( ). Can someone help me about this? I am really new into this.

Here's my Manifest file. Thank you!

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.sti.myactivity">

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".RegisterActivity" />
    <activity android:name=".UserAreaActivity"></activity>
</application>

</manifest>

回答1:

I suggest to import you Icon in the Android Project like this:

Right click on your App folder and go to NEW -> Image Asset and upload the icon there. then it will show up.

You will be presented with this screen where you can simply select your icon.png

Furthermore it automatically scales the Icon in all the different screen densities!

Regarding the updated question:

Do the following things:

  • Make sure your code compiles correctly
  • Make sure the image icon is in mipmap folder, you should look for a folder named AndroidStudioProjects (by default) -> yourProjectName -> App -> src -> main -> res -> mipmap. also make sure that the mipmap folder has the screen density you need (e.g. xhdpi)
  • Use the Run Button on the top in android studio (Command-R on Mac) and make sure you select the right emulator

Anyway Importing the Icon as displayed above, avoids all this problems because it does everything for you.

Hope this helps!



回答2:

You should check on an android phone if you can download and play the app. If the problem is only with the emulator - it does get buggy, so the regular reinstalling the emulator/android studios, restarting your computer, trying to install a different emulator might work.

Otherwise:

The relevant line to look at is:

android:icon="@mipmap/ic_launcher"

This means that the app is going to the 'mipmap' folder inside your directory, and looking for a file named 'ic_launcher' - to display it as the App icon.

You need to make sure this file name exists in the proper folder, and is in the correct format(this guide might help )

How to find the image location folder

If this doesn't help: remember that icons can be displayed at different qualities for different devices (hdpi, mdpi, xhdpi....) so sometimes if you want to make your own icon you need to make sure it fits the requirements (in the above guide)



回答3:

First of all check the logcat for if the application your are developing is even getting installed on the emulator or not. Then if it says that "installing" and if still you don't see your app. Then just build an apk and then try installing it on a mobile device via bluetooth. And for the Application icon just click res>imagge Asset > select your icon for your app to show on any mobile device and then just save/go/apply.