简体   繁体   English

将 APK 上传到 Play 商店时出现“'android:icon' 属性:属性不是字符串值”错误

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

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.经过这么多小时的空闲时间,我准备将我的第一个应用程序发布到 Play 商店,但遗憾的是我在上传已签名的应用程序时遇到了困难。

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 ).我已经使用我创建的密钥库成功导出了该应用程序(全部通过 Eclipse 和 ADT),因此我将签名的 APK 上传到 Play 商店(此处)。

The problem问题

I keep getting this message:我不断收到此消息:

Upload failed Your APK cannot be analyzed using 'aapt dump badging'.上传失败无法使用“aapt dump badging”分析您的 APK。 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错误 output:无法运行 aapt dump badging:W/ResourceType(14856):获取资源编号 0x01080049 的值时未知 package 获取“android:icon”属性时出错:属性不是字符串值

as such:因此:

在此处输入图像描述

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 .该应用程序本身在真实设备上运行良好,所使用的图像文件是android-assets-studio 网站使用的普通 PNG 文件。

What I've tried我试过的

I've searched here on StackOverflow and found many posts about it ( here ).我在 StackOverflow 上进行了搜索,发现了很多关于它的帖子( 此处)。 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).将应用程序图标放在不同的文件夹(“drawable”、“drawable-mdpi”、...甚至“drawable-xxxhdpi”)上,并具有多种组合(从每个文件夹中放置/删除)。

  2. setting the label, icon and theme on both the "application" tag and on the launcher activity tag.在“应用程序”标签和启动器活动标签上设置 label、图标和主题。

  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.检查 Lint 消息。

  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).更新 ADT(至 22.3.0.v201310242005-887826)、Eclipse(至 Kepler Service Release 1)、SDK 工具(至 22.3)、SDK 构建工具(至 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).检查是否没有使用双重 jar 文件(没有 jar 文件存在于多个库中,尤其是当它具有不同版本时)。

  8. tried putting the strings.xml into "res/values-en" instead of "res/values"尝试将 strings.xml 放入“res/values-en”而不是“res/values”

  9. tried adding "android:value" attribute to all meta-data tags on the manifest (suggested by Google).尝试将“android:value”属性添加到清单上的所有元数据标签(谷歌建议)。 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.事实上,在我读过的所有教程中,我从来没有看到 AppWidget 有这样的要求,所以我认为无论如何都不需要。

  10. tried the aapt command:尝试了 aapt 命令:

     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):这向我展示了 Play 商店展示的相同内容(我在这里用 XXX 替换了真实的 package 名称和应用程序名称):

 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.同样,用 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?我该如何克服这个问题?

如果你使用任何android系统图标作为活动图标 (即清单包含<activity ... android:icon="@android:drawable/... ),它们可能是问题。如果你是,试着将这些图标复制到你的项目。在其他地方使用它们应该没问题,因为徽章不会触及那些。

对我而言,我试图将透明图标放在这样的事实:

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

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. 在我的情况下,问题只是我的应用程序的一个依赖项已经宣布他们的一个活动是在他们的清单中使用android:icon =“@ color / black”,而不是使用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). 只有aapt工具报告错误(或上传到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. 请注意,库甚至不需要声明android:icon(它们不是可安装的应用程序!)但是AndroidStudio似乎默认所有项目都在清单中声明一个。

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 错误获取'android:icon'属性:属性不是字符串值

but my problem wasn't related with icon!!! 但我的问题与图标无关!!!

The reason why I get this error was here: 我收到此错误的原因在于:

android:label="@string/app_name" 机器人:标签= “@字符串/ APP_NAME”

My project has 3 different languages, but the main string.xml was without @string/app_name... and this was the reason! 我的项目有3种不同的语言,但主string.xml没有@ string / app_name ......这就是原因!

so be careful! 所以要小心!

I see you tried everything i guess. 我看到你尝试了我想的一切。 Try changing icon maybe? 尝试更换图标可能吗? :) I mean only possiblity that left is your icon. :)我的意思是只留下可能性是你的偶像。

Try creating separate layouts for different screen sizes. 尝试为不同的屏幕尺寸创建单独的布局。 Name the folders as res/layout and res/layout-large 将文件夹命名为res/layoutres/layout-large

I think I was hit by this issue (or something similar, not sure) when I tried to use an XML drawable as the icon (to add padding, etc. to the PNG image). 当我尝试使用XML drawable作为图标(为PNG图像添加填充等)时,我认为我遇到了这个问题(或类似的,不确定)。 I don't think your issue is the same though, since you seem to refer to the PNG file directly. 我不认为你的问题是一样的,因为你似乎直接引用了PNG文件。

Some suggestions to try (to track down the problem by process of elimination): 尝试的一些建议(通过消除过程追踪问题):

  • Remove res/drawable-mdpi/app_icon.png file and see if you got a different error. 删除res/drawable-mdpi/app_icon.png文件,看看是否有其他错误。
  • Remove all android:icon attributes in your manifest and see if you still got the error. 删除清单中的所有android:icon属性,看看是否仍然出现错误。
  • Rename any other resource named app_icon in the project to something else. 将项目中名为app_icon任何其他资源重命名为其他资源。

If all else fail, I would probably start stripping out the external JARs and library projects (and probably temporarily commenting the code that refer to them) just to see if the error was triggered by any of them. 如果所有其他方法都失败了,我可能会开始剥离外部JAR和库项目(并且可能暂时评论引用它们的代码),只是为了查看错误是否被其中任何一个触发。 Or maybe start fresh with a bare minimum AndroidManifest.xml and add your stuff one item at a time. 或者可以从最初的AndroidManifest.xml开始,然后一次添加一个项目。

Another idea is to try to figure out why aapt is producing the error. 另一个想法是试图找出aapt为何产生错误。 Maybe download the source and try to debug it? 也许下载源并尝试调试它?

Have you tried turning your computer off and then on again? 您是否尝试关闭计算机然后再打开?

Try removing android:icon="@drawable/app_icon from the Activity, as it will fall back to the icon specified in the Application. 尝试从Activity中删除android:icon="@drawable/app_icon ,因为它将回退到Application中指定的图标。

Try not using proguard. 尽量不要使用proguard。

In may case, the problem is because I used @null for the value. 在可能的情况下,问题是因为我使用@null作为值。 Completely removing that fixes it. 完全删除它修复它。 The same happens when you put @null for android:icon. 将@null用于android:icon时会发生同样的情况。

I was getting the same issue today and the @Rahl_Pryde's solution worked fine with a minor change. 今天我遇到了同样的问题,而且@ Rahl_Pryde的解决方案在一个小小的改变下运行良好。

In my case, the problem was an android transparent res color to some of my Activity icons. 在我的情况下,问题是我的一些活动图标的android透明res颜色。 But changing to a local transparent color doesn't fixed the problem. 但是改为局部透明色并不能解决问题。

It fixed when changed the icon from a transparent color to a 2x2 transparent png. 将图标从透明颜色更改为2x2透明png时固定。

在我的情况下,我通过使用始终默认的res文件夹,即值,值-es,values-ca解决了它

In my case the problem was occuring because I changed package name before releasing and forgot about changing directory names. 在我的情况下,问题出现了,因为我在发布之前更改了包名,忘了更改目录名。 Project was still compiling but it was impossible to release it on google play. 项目仍在编译,但无法在谷歌播放中发布。

Check in any java file if you have red underlined package name with error 如果您的红色带下划线的包名称有错误,请检入任何java文件

'Package name xxx.yyy.zzz does not correspond to the file path 'xxx.eee.zzz'. '包名称xxx.yyy.zzz与文件路径'xxx.eee.zzz'不对应。

In my case, copied the png I use for my app icon into my "drawable-nodpi" folder and the Play store accepted my apk. 在我的情况下,将我用于我的应用程序图标的png复制到我的“drawable-nodpi”文件夹中,Play商店接受了我的apk。 If you don't have a nodpi folder, then maybe you just need to copy it out of your bucket size related drawable folders, and paste it into the base folder "drawable." 如果您没有nodpi文件夹,那么您可能只需要将其从与桶大小相关的可绘制文件夹中复制出来,然后将其粘贴到基础文件夹“drawable”中。

This seems to be a recent Play store requirement, since I've never seen this error before today. 这似乎是最近Play商店的要求,因为我在今天之前从未见过这个错误。 Take note of androiddeveloper's comment as well. 记下androiddeveloper的评论。

Update 2022: I use aapt2 dump badging instead of aapt dump badging ,and aapt2 will dump ok without errors 2022 年更新:我使用aapt2 dump badging而不是aapt dump badging ,aapt2 将正常转储而不会出现错误

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在将APK上传到PlayStore时错误获取&#39;android:icon&#39;属性:该属性不是字符串值 - ERROR getting 'android:icon' attribute: attribute is not a string value while uploading apk to playstore 将.apk上传到Google Play时出错:此文件无效:获取服务的“ Android名称”属性时出错:该属性不是字符串值 - Error when uploading .apk to google play : this file is invalid: error getting 'android name' attribute for service: attribute is not a string value 上载到Google Play时发生错误:android:label属性:属性不是字符串值 - error on uploading to google play: android:label attribute: attribute is not a string value “获取&#39;android:icon&#39;属性时出错:属性不是字符串值” - “ERROR getting 'android:icon' attribute: attribute is not a string value” 通过 intune 将 APK 上传到 Play 商店时出错? - Getting error while uploading APK through intune to Play Store? 尝试上传到Android电子市场时,“错误获取&#39;android:icon&#39;属性:属性不是字符串值” - “ERROR getting 'android:icon' attribute: attribute is not a string value” when trying to upload to the Android Market Android:上传APK到Play商店时“配置无法发布” - Android: “configuration cannot be published” while Uploading APK to Play Store 将Apk上传到Google Play商店时显示错误消息 - Error message showing while uploading Apk to the google play store 文件无效:错误获取“ android:name”属性:该属性不是字符串值 - The file is invalid: ERROR getting 'android:name' attribute: attribute is not a string value aapt ERROR获取&#39;android:name&#39;属性:属性不是字符串值 - aapt ERROR getting 'android:name' attribute: attribute is not a string value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM