Can't change the default icon of an Android app?

I have a problem. I converted a javascript application to an Android application using phonegap, cordova and eclipse. The application works cool.

But the problem is that it always displays the cordova icon as an application icon . I replaced all the icons in the "project/res" folder. But still only the default icon is displayed?

I searched for it and found out that I need to modify the manifest file. So, I changed the code of AndroidManifest.XML to the code,

 android:icon="@drawable/icon" 

The icon " is my image name.

What is the problem? Why am I not getting my badge? I am new to this Android environment.

I followed this article http://smartgap.wordpress.com/2012/08/11/customizing-launch-icon-on-eclipsephonegap-application/

My manifest file:

 <?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan" package="com.mage.edunxt" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true"> <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" android:resizeable="true" android:anyDensity="true" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_VIDEO"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:hardwareAccelerated="true" android:debuggable="true"> <activity android:name="EduNxtQTIPlayer" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/> </manifest> 
+4
source share
6 answers

I earned it by doing this.

I just put my icon in all the folders inside "project/bin/res" .

Then I added the following line to config.xml under "project/res/xml" .

 <icon src="icon.png" /> 

Now it works cool.

+5
source

I had to do the following

  • add all files to res / Drawables folders
  • set the icon attribute in action in the manifest.xml file. This gave me the ability to view files in my Drawable directories.
  • I had to do a clean job to work.

Clean is really important to keep old badges until you are clean.

In eclipse Project-> Clean

+7
source

I created locally using the CLI. There is no Eclipse and ran into several problems considering the root folder (useless for local assemblies .. Phonegap: how about retrieving some notes when creating).

I finally copied individual icon files of different sizes to the available * folders.

hoods-HDI draw-ldpi draw-MDPI hood-xhdpi

it lost LOOOOOOOT of my time.

+2
source

Make changes to <project location> \ platform \ android \ ant -build \ res, not <project location> \ platform \ android \ res

For some people, changes in the last location may have worked, but noticing that Phonegap was copying from \ android \ res to \ android \ ant -build \ res, I decided to register there and found a separate set of drop-down folders containing the phone bookmark icon by default.

Change of those that finally worked.

Since I create and run locally, and not using Adobe PhoneGap Build, changing the icons in <project location> \ www \ res \ icon \ android will not work either.

0
source

I would also like to share my answer to this question if they cannot get it to work using the steps provided by previous users.

I cannot get my work using the steps given here, and I can figure it out with mipmaps. I created icon sizes with this open source project which is different: Android Asset Studio

Now I notice that the generated icons are now placed in the mipmap folders, and not on drawables. I think this is what Google wants to do to separate the drawings from the icons. Having done this, I reference the recently imported mipmap folders using this:

  android:icon="@mipmap/ic_launcher" 

And here is the folder structure:

 res/ mipmap-mdpi/ic_launcher.png (48x48 pixels) mipmap-hdpi/ic_launcher.png (72x72) mipmap-xhdpi/ic_launcher.png (96x96) mipmap-xxhdpi/ic_launcher.png (144x144) mipmap-xxxhdpi/ic_launcher.png (192x192) 

I cleaned and rebuilt the project, and now I see the icon! But theres a catch. It was added to a later version of Android (v4.3, as indicated here link ). This is not much documentation if it will work in the old version of Android.

0
source

The information provided on the PhoneGap webpage explains this, but at first glance it may not be so clear (link: http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html#_icons ).

A simple explanation: just copy your icon to the root directory of the application and name it icon.png. That is all you need.

In my case, I was convinced that the icon is 96x96px in size (it somehow doesn’t work anymore, but may be my mistake). And also after downloading and rebuilding, the application content was not updated - so I had to repeat the download + rebuild several times.

0
source

All Articles