getting " 'android:icon' attribute: attribute is not a string value” error while uploading an APK to the play store

10,333

Solution 1

If you are using any android system icons as activity icons (i.e. manifest contains <activity ... android:icon="@android:drawable/... ) , they could be the problem. If you are, try copying these icons into your project. Using them elsewhere should be no problem since badging doesn't touch those.

Solution 2

for me it was the fact that I tried to put transparent icons like this:

android:icon="@android:color/transparent"

Solution 3

I know that there is correct answer, but i believe that my experience can help some one...

so i receive the same error:

ERROR getting 'android:icon' attribute: attribute is not a string value

but my problem wasn't related with icon!!!

The reason why I get this error was here:

android:label="@string/app_name"

My project has 3 different languages, but the main string.xml was without @string/app_name... and this was the reason!

so be careful!

Solution 4

In my case, the issue was simply that one of my app's dependencies had declared one of their activities to use android:icon="@color/black" in their manifest, instead of using a drawable. You don't get any compilation errors, and the apps works just fine. Only the aapt tool reports the error (or uploading to the Playstore). Note, libraries don't even need android:icon to be declared (they're not an installable app!) but AndroidStudio appears to default all projects to declare one in the manifest.

Share:
10,333

Related videos on Youtube

android developer
Author by

android developer

Really like to develop Android apps &amp; libraries on my spare time. Github website: https://github.com/AndroidDeveloperLB/ My spare time apps: https://play.google.com/store/apps/developer?id=AndroidDeveloperLB

Updated on May 02, 2020

Comments

  • android developer
    android developer about 4 years

    Background

    After so many hours of my free time, I'm ready to publish my very first app to the play store, but sadly I'm having difficulties uploading the signed app.

    I've successfully exported the app with the keystore I've created (all via Eclipse & ADT), so I have the signed APK to be uploaded to the play store (here).

    The problem

    I keep getting this message:

    Upload failed Your APK cannot be analyzed using 'aapt dump badging'. Error output: Failed to run aapt dump badging: W/ResourceType(14856): No known package when getting value for resource number 0x01080049 ERROR getting 'android:icon' attribute: attribute is not a string value

    as such:

    enter image description here

    The app itself works very well on real devices, and the image file being used is a normal PNG file as used by the android-assets-studio website.

    What I've tried

    I've searched here on StackOverflow and found many posts about it (here). I've read many of them and tried the next things, but nothing has helped:

    1. put the app icon on a different folder/s ("drawable", "drawable-mdpi", ... even "drawable-xxxhdpi") with multiple combinations (put/remove from each of the folders).

    2. setting the label, icon and theme on both the "application" tag and on the launcher activity tag.

    3. change the image file name and the file itself (replaced it with the default app icons).

    4. clean up the project.

    5. Checking Lint messages.

    6. updating ADT (to 22.3.0.v201310242005-887826), Eclipse (to Kepler Service Release 1), SDK tools (to 22.3), SDK build tools (to 19.0.1). Everything is pretty much the latest official version.

    7. checking that there's no double jar file being used (that no jar file exists on more than one library, especially if it has different versions).

    8. tried putting the strings.xml into "res/values-en" instead of "res/values"

    9. tried adding "android:value" attribute to all meta-data tags on the manifest (suggested by Google). It didn't work. In fact, in all of the tutorials I've read, I never saw such a requirement from an AppWidget, so I think it's not needed anyway.

    10. tried the aapt command:

      aapt dump badging
      

    This has shown me about the same thing the play store shows (I've replaced the real package name and app name with XXX just here):

    application: label='XXX XXX' icon='res/drawable-mdpi/app_icon.png'
    launchable-activity: name='XXX.XXX.XXXActivity'  label='XXX XXX' icon='res/drawable-mdpi/app_icon.png'
    W/ResourceType( 9132): No known package when getting value for resource number 0
    x01080049
    ERROR getting 'android:icon' attribute: attribute is not a string value
    

    This happens even though the file do exist inside this folder.

    Here's the manifest. Again, replaced the real paths and names of the activities and app with XXX. I can assure you that the paths are correct as the app can run just fine.

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        package="XXX.XXX"
        android:installLocation="auto"
        android:versionCode="2"
        android:versionName="1.0" >
    
        <uses-sdk
            android:minSdkVersion="9"
            android:targetSdkVersion="19" />
    
        <supports-screens
            android:anyDensity="true"
            android:largeScreens="true"
            android:normalScreens="true"
            android:smallScreens="true"
            android:xlargeScreens="true" />
    
        <uses-permission android:name="com.android.launcher
                                       .permission.INSTALL_SHORTCUT" />
        <uses-permission android:name="android
                                       .permission.KILL_BACKGROUND_PROCESSES" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
    
        <!-- required for admob: -->
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.INTERNET" />
    
        <!-- required for in-app billing . -->
        <uses-permission android:name="com.android.vending.BILLING" />
        <!-- needed for payload of in-app billing -->
        <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    
        <application
            android:name="XXX.XXX.XXX"
            android:allowBackup="true"
            android:description="@string/app_description"
            android:hardwareAccelerated="true"
            android:icon="@drawable/app_icon"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
    
            <activity
                android:name="XXX.XXXActivity"
                android:clearTaskOnLaunch="true"
                android:configChanges="keyboard|keyboardHidden|orientation|
                                       screenLayout|uiMode|screenSize|
                                       smallestScreenSize"
                android:finishOnTaskLaunch="true"
                android:icon="@drawable/app_icon"
                android:label="@string/XXX"
                android:launchMode="singleTask"
                android:screenOrientation="fullSensor" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
         ... (other activities and services)
    

    The question

    What is going on?

    How do I overcome this?

    • Archie.bpgc
      Archie.bpgc over 10 years
      This might help. It says, the error might be misleading, meaning: it can be related to the strings in the resource folder etc..
    • android developer
      android developer over 10 years
      @Archie.bpgc yes, i've read similar posts, and tried to figure out which string is problematic. can't find any, and I've also found out that the resource id that aapt complains about doesn't even exist (searched the entire workspace), but the one of the app icon do.
    • user666
      user666 over 10 years
    • android developer
      android developer over 10 years
      @user3134811 i've already wrote that i've tried it. sadly it didn't help... :(
    • cbrulak
      cbrulak over 10 years
      Have you tried installing the signed APK on a clean device? And of course, launching it,etc.
    • android developer
      android developer over 10 years
      @cbrulak I've now uninstalled the app and installed&run the signed app. works just fine, as before.
    • FunkTheMonk
      FunkTheMonk over 10 years
      Are you using proguard or something similar?
    • android developer
      android developer over 10 years
      @FunkTheMonk yes, using the default configurations of it.
    • Daiwik Daarun
      Daiwik Daarun over 8 years
      @Archie.bpgc following that post led me to an answer :) I had different app names for production and dev and did not update these when I added translations
  • android developer
    android developer over 10 years
    will try it out, but it's not that Android can't handle it... the app runs just fine with this png file.
  • user666
    user666 over 10 years
    Yes but maybe something about image's properties doesn't fit Google Play's requirements. I know its a low shot.
  • user666
    user666 over 10 years
    Then try mailing Google Play Support about it if you haven't already.
  • android developer
    android developer over 10 years
    ok i've tried to replace the icons files with the default ones, and i still get the same error. how do i mail the google-play-support? from here: support.google.com/googleplay/android-developer/… ?
  • user666
    user666 over 10 years
  • android developer
    android developer over 10 years
    I've emailed them, and they returned me an answer. I'll write here an answer in case it helps me getting out of this mess.
  • android developer
    android developer over 10 years
    They told me to add "android:value" to all meta-data tags. I have only one which is of an AppWidget. still didn't work and it makes sense since AppWidget doesn't need it - it never had it on any tutorial I've seen
  • android developer
    android developer over 10 years
    Using the Android resources is a trivial and allowed thing, and Google already said in a lecture that it's OK to use them. As an example, they've talked about strings like "ok" and "cancel" which are translated to multiple languages.
  • android developer
    android developer over 10 years
    Nevertheless, I will try to do as you offered.
  • Pablo_Cassinerio
    Pablo_Cassinerio over 10 years
    Of course it's allowed and everyone does it, I'm just saying that it's been known to be a cause of issues
  • FunkTheMonk
    FunkTheMonk over 10 years
    @androiddeveloper updated my answer with a new suggestion (try not using proguard)
  • android developer
    android developer over 10 years
    That's weird. was sure i had proguard enabled. it's good that you've told me about it. it was disabled all this time... now i will use it, by adding the next line to the "project.properties" file: proguard.config=${sdk.dir}/tools/proguard/proguard-android.t‌​xt:proguard-project.‌​txt . sadly, it didn't help too (having it either enabled or disabled).
  • android developer
    android developer over 10 years
    Google also told me to try to write a question on their forums (like here: groups.google.com/forum/#!forum/android-developers ) , but for some reason my question wasn't published . :(
  • user666
    user666 over 10 years
    I think you just have bad luck about Android Development.
  • android developer
    android developer over 10 years
    This is the correct answer. How very odd. only image files couldn't be used. other resources are fine (strings, layouts, ids...). I wonder if it's only a part of the images, or all of them, that needed to be replaced with images within my app. I also wonder how come this is happening at all.
  • android developer
    android developer over 10 years
    Those didn't help. I've found out the problem though I don't understand why it happens. i've ticked the answer here. if you wish, you can join and say what you think about it... :)
  • android developer
    android developer over 10 years
    I've found out the problem though I don't understand why it happens. i've ticked the answer here. if you wish, you can join and say what you think about it... :)
  • android developer
    android developer over 10 years
    I've found out the problem but I don't understand why it happens. i've ticked the answer here. if you wish, you can join and say what you think about it... :)
  • user666
    user666 over 10 years
    Oh, i didn't see that. I'm glad you fixed your problem finally :)
  • android developer
    android developer over 10 years
    can you please show some links of how you've found this answer? I don't even understand what it's supposed to be and why it happens, as the resources are there...
  • Pablo_Cassinerio
    Pablo_Cassinerio over 10 years
    I knew the answer because I'd seen it happen before where I work and that's how it got solved. Nevertheless, it seems it is a common bug groups.google.com/forum/#!topic/android-developers/F1F3fRKBi‌​oQ . Anyway, glad you solved it.
  • android developer
    android developer over 10 years
    Nice, so it's a bug on the play store (or aapt which the play store probably uses) , right?
  • Pablo_Cassinerio
    Pablo_Cassinerio over 10 years
    I believe it might be a long going bug, some believe Google doesn't want built-in icons in our apps ( blackmoonit.com/2010/07/market-disallow-use-of-android-icons ) but it's the way it works.
  • android developer
    android developer over 10 years
    So i should have searched more about this problem to find this out. I see. Thanks for all your time.
  • CMPS
    CMPS about 10 years
    Please put this comment below Rahl_Pryde's answer, because you are posting your comment as an answer to this question
  • RubensBrilhante
    RubensBrilhante about 10 years
    Can't do that because of my low reputation.
  • android developer
    android developer almost 10 years
    I don't understand what you mean. these are the standard folders. you can't use folders that have bad qualifiers...
  • nrikee
    nrikee almost 10 years
    Sorry about that poor explanation, I'm going to tell exactly what I've done: I had the following folders: "values" "values-ca" "values-es" Inside "values-ca" and "values-es" I had a file which wasn't in "values". I copied that file into "values" and that solved our problem. You should have each file that you have in "drawable-*" in "drawable".
  • android developer
    android developer almost 10 years
    oh, I see, though "drawable" isn't supposed to have images but only XML files, since "drawable" is the same as "drawable-mdpi" .
  • Mark McClelland
    Mark McClelland over 9 years
    An alternative approach is to use a 1x1 transparent drawable to eliminate the activity icon(s).
  • Arslan Khalid
    Arslan Khalid over 8 years
    @androiddeveloper Tried the solution which Pablo mentioned and its still not working.
  • android developer
    android developer over 8 years
    @ArslanKhalid go over various resources that you use. maybe try what i did.
  • Arslan Khalid
    Arslan Khalid over 8 years
    @androiddeveloper I have gone through all of the things you mentioned and almost tried every solution but still no success.
  • android developer
    android developer over 8 years
    @ArslanKhalid Try checking if it's not your code's fault, as it could be someones else's (a library that uses weird resources).
  • David Conlisk
    David Conlisk about 8 years
    I had the same, but removing it has had no discernible effect on the app (worth a try, rather than going to the bother of creating a transparent drawable)
  • TomTomZJ
    TomTomZJ almost 8 years
    I Love You ! :) You made my day! I tried SO many things on icons, res folders and so many other thigs. I am guilty of not adding that line in strings.xml, BUT google being a bit more specfific would not harm at all :) Thank you very much @Stan!
  • Stan Malcolm
    Stan Malcolm almost 8 years
    :) glad to help! Peace ;-)
  • whyoz
    whyoz over 7 years
    @androiddeveloper I've been using it for png files for years knowing that, but if you don't have vectors, using the nodpi folder for large pngs can save on memory if you have the same background image for multiple activities, allowing you to remove those pngs from bucket related drawable folders. Thanks a ton for the vector comment droiddev!
  • android developer
    android developer over 7 years
    Correction: "anydpi" is used for VectorDrawable. However, I don't think "nodpi" doesn't saves you on memory, and you don't have to put images in all density buckets. One of high density is enough, and it will actually save you on memory, because for lower densities, the bitmap will be smaller using downsampling, automatically