Can't change the default icon of Android app?

20,457

Solution 1

I got it worked by doing these.

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

Then i added the following line in config.xml under "project/res/xml".

<icon src="icon.png" /> 

Now it is working cool.

Solution 2

I had to do the following

  1. add all the files to my res/Drawables folders
  2. set the icon attribute on the activity in the manifest.xml. It gave me the option to browse for the files setup in my Drawable directories.
  3. I had to do a clean for it to work.

The clean is really important it seems to keep using the old icons until you clean.

In eclipse Project->Clean

Solution 3

i have been building locally using phonegap CLI. No Eclipse and ran into multiple problems as looking at root folder ( useless for local builds.. Phonegap: how about spewing some notes when building ).

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

drawable-hdpi drawable-ldpi drawable-mdpi drawable-xhdpi

this wasted LOOOOOOOT of my time.

Share:
20,457
Edwin Alex
Author by

Edwin Alex

A techie with 10 years of experience in web development. Good in building architecture and solution for complex problems. Excellent knowledge and working experience in Microservice architecture. Extensive knowledge in full life-cycle of the web development process including gathering requirements, designing, coding, testing, debugging, deployment and maintenance. Expert in Object-oriented programming concepts [OOPs]. Known for abilities of Research &amp; Development, hard work, self, and fast learning. Skilled in Website performance optimization &amp; Client-side page rendering. Expert in IMS Technology Standard QTI [ Questions &amp; Test Interoperability]. Hands-on Experience in managing a team. Interested in learning new technologies and working in new domains.

Updated on January 25, 2020

Comments

  • Edwin Alex
    Edwin Alex over 4 years

    I am facing a problem. I have converted a javascript application to Android app by using phonegap, cordova and eclipse. The App works cool.

    But the problem is, it always displays cordova icon as app icon. I replaced all the icons in the "project/res" folder. But still it shows the default icon only?

    I googled it and came to know that i have to change in the manifest file. So, i changed in the AndroidManifest.XML with the code,

    android:icon="@drawable/icon"
    

    "icon" is my image name.

    What is the problem here? Why i am not getting my own icon? 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>