android 上傳市集時出現ERROR getting 錯誤

來源:互聯網
上載者:User

標籤:

  最近接手了一個bug,是上傳市集的時候,部分市集會調用aapt工具擷取apk資訊,在擷取資訊時會出現以下類似錯誤。

package: name=‘com.xxx.activity‘ versionCode=‘1‘ versionName=‘1.0‘

sdkVersion:‘8‘

targetSdkVersion:‘21‘

application-label:‘鎺屼腑搴嗛槼‘

application-icon-120:‘res/drawable-ldpi-v4/ic_launcher.png‘

application-icon-160:‘res/drawable-mdpi-v4/ic_launcher.png‘

application-icon-240:‘res/drawable-hdpi-v4/ic_launcher.png‘

application-icon-320:‘res/drawable-xhdpi-v4/ic_launcher.png‘

application-icon-480:‘res/drawable-xxhdpi-v4/ic_launcher.png‘

application: label=‘鎺屼腑搴嗛槼‘ icon=‘res/drawable-mdpi-v4/ic_launcher.png‘

application-debuggable

launchable-activity: name=‘com.xxx.activity.xxxActivity‘  label=‘‘ ico

n=‘‘

ERROR getting ‘android:name‘ attribute: attribute is not a string value

這個錯誤並不長出現,只有一些國外的解決文章,還是花了一些時間才解決,這裡記錄一下了,如果少年們出現了類似的問題也可是試一下下面的解決方案。


首先我們如果出現上傳問題以後可以使用aapt工具檢測一下,工具在 sdk build-tools 檔案夾下,用 cmd 的方式開啟。

命令是 aapt dump badging xx.apk xx為應用程式名稱,意思是擷取apk相關資訊。當程式出現問題就會出現和市集相同的提示資訊。

ERROR getting ‘android:name‘ attribute: attribute is not a string value

在我接手的項目裡面出現這個問題的原因是,AndroidManiFest 中 activity 的 android:name= 用了@string的模式,這種相關的使用方式導致 aapt 無法識別。

修改方法就是把 @string 中的字串複製到 android:name 中,然後使用 aapt 工具跑一下就可以解決問題了。如果重新打包的應用上傳的市集時還出現錯誤提示,可以嘗試重新整理頁面。

          <!-- 回調activity -->        <activity            android:name="@string/weixin_callback"            android:configChanges="keyboardHidden|orientation|screenSize"            android:exported="true"            android:screenOrientation="portrait"            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

網上有國外的解決方案是吧 AndroidMainFest中所有 @string 都是用硬式編碼方式寫到檔案裡,這裡其實並不需要的,只要沒有提示 ERROR getting ‘android:label‘ attribute: attribute is not a string value 或者是其他的類似提示,都只要修改 activity 裡 android:name 就可以了。

android 上傳市集時出現ERROR getting 錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.