ERROR getting 'android:label' attribute: a

2019-04-22 03:17发布

问题:

I have this error "ERROR getting 'android:label' attribute: attribute is not a string value" when trying to publish my application to android market. Some time ago this app was already published successfully on market, but when I apply minor changes in AndroidManifest.xml (changing versionCode and versionName) I get this error constantly.

I looked to all similar topics here, such as:

Android Market Publishing Issues

"ERROR getting 'android:icon' attribute: attribute is not a string value" when trying to upload to the Android Market

The file is invalid: ERROR getting 'android:name' attribute: attribute is not a string value

but none of these solution helped me. Do you know any other reason of such an error? Here is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.samsung.att.deskhome" android:versionCode="12" android:versionName="2.3"> 
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<application android:icon="@drawable/mainmenu_icon_homemount" android:label="@string/app_name">
<activity android:name=".CradleMain" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" android:launchMode="singleTask" >
<meta-data android:name="android.dock_home" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DESK_DOCK" />
</intent-filter>
</activity>     
<activity android:name=".CradleHomeSettings" android:label="@string/cradle_home_settings" android:launchMode="singleTask" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DESK_DOCK" />
</intent-filter>
</activity>
<activity android:name=".CradleWeatherSettings" android:label="@string/cradle_weather_settings" android:launchMode="singleTask" android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DESK_DOCK" />
</intent-filter>
</activity>
<activity android:name=".CradleWallpaperChooser" android:label="@string/pick_wallpaper" android:screenOrientation="nosensor" android:finishOnCloseSystemDialogs="true" android:configChanges="locale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DESK_DOCK" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-sdk android:maxSdkVersion="10" />
</manifest> 

回答1:

Whenever you get an error from the play store while uploading make sure to execute that same command locally to get proper output. The output retrieved from the online console is misleading.

An example from my own code, this is what I got on the online console:

Failed to run aapt dump badging:
W/ResourceType( 4560): Failure getting entry for 0x7f0601c6 (t=5 e=454) in package 0 (error -75)
ERROR getting 'android:label' attribute: attribute is not a string value

And a local run of that same tool (found at build-tools in sdk dir)

aapt dump badging /path/to/your/apk

revealed useful information like the position where the check failed:

package: name='X' versionCode='X' versionName='X'
sdkVersion:'7'
targetSdkVersion:'17'
uses-permission:'android.permission.INTERNET'
...
uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'
uses-feature-not-required:'android.hardware.camera'
uses-feature-not-required:'android.hardware.camera.autofocus'
application-label:'Photo Tools'
application-label-zh:'摄影工具'
application-label-nl:'Photo Tools'
application-label-fr:'Photo Tools'
application-label-es:'Photo Tools'
application-label-it:'Photo Tools'
application-label-ru:'Photo Tools'
application-icon-160:'res/drawable/phototools_icon.png'
application-icon-240:'res/drawable/phototools_icon.png'
application-icon-320:'res/drawable/phototools_icon.png'
application-icon-480:'res/drawable/phototools_icon.png'
application: label='Photo Tools' icon='res/drawable/phototools_icon.png'
launchable-activity: name='be.hcpl.android.phototools.PhotoToolsActivity'  label='Photo Tools' icon=''
W/ResourceType(30945): Failure getting entry for 0x7f0601c6 (t=5 e=454) in package 0 (error -84)
ERROR getting 'android:label' attribute: attribute is not a string value


回答2:

To investigate, I followed the following methodology:

  1. comment out the activities one by one
  2. build the signed release
  3. run aapt dump badging /path/to/your/apk
  4. see errors and repeat

This allowed me to narrow down to the root the of my problem. Just a string without resource instead the label was not being used in the app. I removed the label attribute as a fix.



回答3:

read @hcpl answer, if you cannot finsd the error look for the next activity listed in manifest. in his post:

launchable-activity: name='be.hcpl.android.phototools.PhotoToolsActivity'  label='Photo Tools' icon=''
W/ResourceType(30945): Failure getting entry for 0x7f0601c6 (t=5 e=454) in package 0 (error -84)
ERROR getting 'android:label' attribute: attribute is not a string value

You might think the problem is related to PhotoToolsActivity but it is about the next activity which does not get log because it aapt crashes



回答4:

Check the values/strings.xml and values-xx/strings.xml You should be sure that everyone word in values/strings.xml must have corresponding word under values-xx/strings.xml .



回答5:

In my case, the default string.xml was missing, accidentally deleted from the project.

I use:

disable 'ExtraTranslation'
disable 'MissingTranslation'

in the gradle, so I've no evidence of the missing string.xml file.