As mentioned in the title, my launcher icon is showing up fine on the emulator, but the default icon was shown on my phone.
Here's my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ytz.bc"
android:versionCode="1"
android:versionName="1.0a" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".ProjectBriefcaseActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
Most likely, you have replaced the default icon with your icon only in one of the drawable folders, and coincidentally the emulator is using the folder, while your device is using one of the other folders. See this link for icon design guidelines, and this one for the recommended size.
Can you post what's there in all your drawable folders?
You might have done this thing: replaced the ic_launcher.png file in drawable-mdpi folder with another image(your launcher icon) and named it ic_launcher.png .
You actually do not need to rename the file icon file you out in the drawable folder, but you need to change the android manifest to tell the application which file to use as the launcher icon.
Suppose if i put launcher_icon.png in the drawable-mdpi folder, and i want that to be my launcher icon, i will change the manifest to this:
<application
android:icon="#drawable/launcher_icon"
android:label="#string/app_name" >
I changed the tag
android:icon="#drawable/ic_launcher"
to
android:icon="#drawable/launcher_icon"
paste your launcher image and do the change according to the file name of that image...
If you have placed your icons correctly, still you don't see the icon change then, go to Project->Clean....
In res folder inside bin you will find all your resouce items. You can check before cleaning the project and you will find that you have the old ic_launcher file. If you clean the project, these folders will be deleted. When you run your application again a new set of files will be copied and your application icon will be changed.
Hope this helps.
Note: This will work only when you have replaced the icons in all the folders still you are getting the old icon.
Related
I'm trying to add a launcher icon to my android app. I have watched multiple tutorials online that explain how that works. I ended up doing it this way:
https://www.youtube.com/watch?v=DQ8HDL-X9rM
The laucher icon does appears in the android simulator but not on physical phones.
what I have tried to do:
clean the build in android studio
reset the icon the way it says in the tutorial
checked the reference in android manifest
checked if the icon was changed in the drawable and mipmap folders
that were the tips that showed up in a stackoverflow topic a couple years back.
I have been working on it for the passed week and I just can't get it to work.
This is my ic_launcher.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="#color/ic_launcher_background"/>
<foreground android:drawable="#mipmap/ic_launcher"/>
</adaptive-icon>
And this is this are the lines in my AndroidManifest
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
<activity android:name="com.example.fragments.Product">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.MainActivity" />
</activity>
<activity android:name="com.example.MainActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
Also I checked all the mipmap folders and all my icons are in there with the correct names.
Does anyone know what I can do?
---update june 3---
Now its not even showing up on the emulator anymore...
I have tried and read all the topics online I really hope someone can spot what I do wrong
You can simple way to add icon for app
go to project
app->res->drawable->right click->new->image asset-> source asset
select image path and click to next button
RUN the app
another way
I know how to change the icon of my app, but when I look at the Recents Screen, the icon is the default one.
App icon (all good so far):
Icon in my Recents Screen:
This is the 'application' tag of my 'AndroidManifest.xml'
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/iconout"
android:roundIcon="#mipmap/iconout"
android:logo="#mipmap/iconout"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
I've tried many solutions that I found on this platorm (that didn't work), like:
file->new->image asset->choose image..
install & unistall the app
build & clean project
delete all the default icons on my project
drag & drop my icon to drawable from mipmap folder
Any other possible solutions? Thank you in advance!
Ok I found the solution and decided to answer for anyone that will encounter the same problem in the future.
I fixed it by adding android:icon="#mipmap/iconout" in the main activity tag declaration in the AndroidManifest.xml, like so:
<activity
android:icon="#mipmap/iconout"
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And here's the final result:
Try to change the format of the icon to PNG. That works for me.
Or you could try the application on different devices to see if it's not a problem of the emulator/phone.
I am writing a very simple app as a starter and using a material design icon as the launcher icon. Is there a way I can set the colour of just the launcher icon like I can the size and shape?
Here is my code from AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/gasstation"
android:label="#string/app_name"
android:iconTint="#color/sysGreen"
android:roundIcon="#drawable/gasstation"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
The statement android:iconTint seems to be OK in that Android Studio has not flagged it as an error but it has no effect. The launcher icon is still the grey colour of the downloaded image resource.
Is this possible? Any help greatly appreciated.
If you retrieve the icon from a drawable, basically a small image you have in your resources, you cannot change the color.
What you can instead do is to use the tool Image Asset Studio, here is the link
As explained
In the Project window, select the Android view. Right-click the res
folder and select New > Image Asset.
then follow the guide..
Anyway from API version 21, you can tint drawables,
as explained in this post
Well ... I finally did it as follows.
right click on res>new image asset>clip art>pick the icon
you can set the foreground colour manually in the Configure Image Asset screen
How can I change the launcher icon and its label from my application runtime in Android? (if it is possible)
I mean the properties defined in AndroidManifest.xml: android:icon and android:label. I want to replace it by the image I take from the camera.
This entire answer is from this post and it was taken from P-A and CommonsWare.
You cannot change the manifest or the resource in the signed-and-sealed APK, except through a software upgrade. or
Try this, it`s work fine for me but not sure for all devices:
Modify your MainActivity section in AndroidManifest.xml, delete from it, line with MAIN category in intent-filter section.
<activity android:name="ru.quickmessage.pa.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#style/CustomTheme"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />//DELETE THIS LINE
</intent-filter>
</activity>
Create <activity-alias> for your app, for each of your icons. Like this
<activity-alias android:label="#string/app_name"
android:icon="#drawable/icon"
android:name=".MainActivity-Red"
android:enabled="false"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
Set programmatically ENABLE attribute for necessary
getPackageManager().setComponentEnabledSetting(
new ComponentName("ru.quickmessage.pa", "ru.quickmessage.pa.MainActivity-Red"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Note, At least one must be enabled and above code perfect working up to 4.0 not tested into >4.0.
Edit: your original answer didn't specify you wanted to do it at runtime. Below the line is how to do it before it compiles. As for doing it programmatically at runtime:
From this answer:
You cannot change the manifest or the resource in the signed-and-sealed APK, except through a software upgrade.
But also, the accepted answer figured out a "hack" or some cheating way to do it (I presume). I haven't tested it, but there is a source for you to check out.
Or, this link apparently describes how to do this using the "widget" approach.
So lets say your manifest was like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="yourPackage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
...
You would change the launcher icon by putting images into your drawable folders:
Project folder --> res --> all the drawables
Then you would change the android:icon="#drawable/ic_launcher" to be android:icon="#drawable/whateverTheNameOfTheImageIsYouPutInTheDrawablesFolders"
To change the label:
Open up your strings.xml file which is located:
Project folder --> res --> values --> strings.xml
And look for the string that looks like this:
<string name="app_name">Your App Name</string>
And just change Your App Name to be whatever you want the label to be.
Summary:
android:icon="#drawable/ic_launcher" determines your launcher icon, so just add images to the drawable folders and change ic_launcher to whatever the name of image is that you want to be the icon.
android:label="#string/app_name" determines your "label" so just look for app_name (because the label is referenced to #string/app_name) in your strings.xml file and change the contents of app_name.
I created an Android-Maven archetype project using command line (http://stand.spree.de/wiki_details_maven_archetypes).
When I imported this project to ADT (so that I can take some advantage of the graphical editor), I found the graphical editor doesn't show the view correctly.
For the auto generated activity_main.xml under res/layout, it doesn't displaying the expected layout. Instead, it complains:
No resources match the configuration
, , Locale Language ___Region __, Left To Right, sw320dp, w320dp, h533dp, Normal Screen, Long screen aspect ratio, Portrait Orientation, Normal, Day time, High Density, Finger-based touchscreen, Soft keyboard, No keyboard, Exposed navigation, Trackball navigation, Screen resolution 800x480, API Level 18
Change the configuration or create:
res/layout-ldltr-sw320dp-w320dp-h533dp-normal-long-port-notnight-hdpi-finger-keyssoft-nokeys-navexposed-trackball-800x480-v18/activity_main.xml
You can also click the 'Create New...' item in the configuration dropdown menu above.
Screen shot as below:
Here is the project directory:
This Activity_Main.xml is pretty straight forward as below:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/activity_main_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Project.properties file:
# Project target.
target=android-16
And AndroidManifest is also simple:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.hizz.android"
android:versionCode="1"
android:versionName="1.0-SNAPSHOT" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity android:name=".HelloAndroidActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I am not sure what I should do to make it show on the graphical editor.
Please help out, and let me know if you need any extra information.
Clean your project and restart eclipse, it always happens to me