2011-09-28 141 views
9

當我試圖將我的應用程序發佈到android市場時,出現此錯誤「ERROR getting'android:label'attribute:attribute is not a string value」。 前段時間這個應用程序已經在市場上成功發佈,但是當我在AndroidManifest.xml中應用較小的更改(更改versionCode和versionName)時,我不斷得到此錯誤。錯誤獲取'android:label'屬性:屬性不是字符串值

我看了所有類似的話題在這裏,如:

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

但這些解決方案幫助了我。你知道這種錯誤的其他原因嗎? 這裏是我的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> 
+6

問題的原因是values/strings.xml不包含「android:label」屬性之一,儘管它在其他本地化的strings.xml中。 – amilien

回答

10

每當您在上傳確保在本地執行相同的命令來獲得適當的輸出從Play商店得到一個錯誤。從在線控制檯檢索到的輸出具有誤導性。

從我自己的代碼的一個例子,這是我在網上控制檯上了:

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 

這同一工具的本地運行(發現在SDK目錄構建工具)

aapt dump badging /path/to/your/apk 

顯露等,其中檢查失敗的位置的有用信息:

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 
+1

我得到同樣的錯誤,你的答案缺少解決方案,你得到這個轉儲後做了什麼 – meda

+2

@meda對我來說,在另一個strings.xml文件中翻譯時,缺省的字符串值缺失 – hcpl

1

進行調查,我也跟着個Ë以下方法:

  1. 評論的活動一個接一個
  2. 打造簽署發佈
  3. 運行AAPT轉儲徽章/路徑/到/你/ APK
  4. 看到錯誤和重複

這讓我縮小了我的問題的根源。只是一個沒有資源的字符串,而不是在應用程序中使用標籤。我刪除了標籤屬性作爲修復。

1

閱讀@hcpl答案,如果您無法找到錯誤,請查找清單中列出的下一個活動。在他的職位:

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 

你可能會認爲這個問題是關係到PhotoToolsActivity,但它是關於下一個活動不得到記錄,因爲它aapt崩潰

0

檢查值/ strings.xml中和值 - xx/strings.xml 您應該確保values/strings.xml中的每個單詞必須在values-xx/strings.xml下具有相應的單詞。

0

在我的情況下,缺省的string.xml丟失,意外從項目中刪除。

我用:

disable 'ExtraTranslation' 
disable 'MissingTranslation' 

在gradle這個,所以我沒有失蹤string.xml文件的證據。