无法更改Android应用的默认图标?

时间:2013-04-15 07:59:21

标签: android eclipse cordova icons

我遇到了问题。我已经使用phonegap,cordova和eclipse将javascript应用程序转换为Android应用程序。该应用程序很酷。

但问题是,它始终显示 cordova图标作为应用图标。我替换了"project/res"文件夹中的所有图标。但它仍然只显示默认图标?

我用谷歌搜索它并且知道我必须在清单文件中进行更改。所以,我使用代码<{1}}更改了AndroidManifest.XML

android:icon="@drawable/icon"

“icon”是我的图片名称。

这是什么问题?为什么我没有自己的偶像?我是这个Android环境的新手。

我遵循了这篇文章http://smartgap.wordpress.com/2012/08/11/customizing-launch-icon-on-eclipsephonegap-application/

我的清单文件:

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

6 个答案:

答案 0 :(得分:7)

我必须做以下

  1. 将所有文件添加到我的res / Drawables文件夹
  2. 在manifest.xml中设置活动的icon属性。它让我可以选择浏览Drawable目录中的文件设置。
  3. 我必须干净才能工作。
  4. 干净是非常重要的,它似乎继续使用旧图标,直到你清理。

    在eclipse Project-&gt; Clean

答案 1 :(得分:5)

通过这样做我得到了它。

我只是将我的图标放在"project/bin/res"内的所有文件夹中。

然后我在"project/res/xml"下的 config.xml 中添加了以下行。

<icon src="icon.png" /> 

现在它很酷。

答案 2 :(得分:2)

我一直在使用phonegap CLI在本地构建。没有Eclipse并且在查看根文件夹时遇到了多个问题(对本地构建没用.Phonegap:在构建时如何喷出一些注释)。

我最终将不同大小的单个图标文件复制到drawable *文件夹中。

抽拉-HDPI 绘制,LDPI 绘制,MDPI 抽拉-xhdpi

这浪费了 LOOOOOOOT 我的时间。

答案 3 :(得分:0)

在&lt;项目位置&gt; \ platforms \ android \ ant-build \ res中进行更改,而不是&lt;项目位置&gt; \ platforms \ android \ res

对于有些人在后一个位置进行更改可能有效,但是注意到Phonegap从\ android \ res复制到\ android \ ant-build \ res,我决定在那里办理登机手续并找到一套单独的可绘制文件夹包含默认的phonegap图标。

改变那些最终有效。

由于我在本地构建和运行而不使用Adobe PhoneGap Build,因此更改&lt; project location&gt; \ www \ res \ icon \ android中的图标也不起作用。

答案 4 :(得分:0)

我也想在这个问题上分享我的答案,以防他们无法使用之前用户提供的步骤让它工作。

我无法使用此处提供的步骤让我工作,我可以通过使用mipmap了解它。我使用这个开源项目生成了图标大小,这很棒:Android Asset Studio

我现在注意到生成的图标现在放在mipmap文件夹中,而不是放在drawables上。我认为谷歌希望我们将抽象与图标分开。完成此操作后,我使用以下方法引用新导入的mipmap文件夹:

 android:icon="@mipmap/ic_launcher"

这是文件夹结构:

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)

我清理并重建了项目,现在我可以看到图标了!但是有一个问题。它被添加到更高版本的android(v4.3,如此处所述link)。如果这可以在旧版本的android上运行,那么没有太多的文档。

答案 5 :(得分:0)

PhoneGap网页上提供的信息解释了这一点,但乍一看可能不太清楚(链接:http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html#_icons)。

简单说明:只需将您的图标复制到应用程序根目录并将其命名为icon.png。这就是你所需要的一切。

在我的情况下,我确定,图标的大小为96x96px(更大的某种方式不起作用,但可能是我的错)。上传和重建后,应用内容也没有更新 - 所以我需要重复上传+重建几次。

相关问题