android 上传应用商店时出现ERROR getting 错误

  最近接手了一个bug,是上传应用商店的时候,部分应用商店会调用aapt工具获取apk信息,在获取信息时会出现如下相似错误。android

package: name='com.xxx.activity' versionCode='1' versionName='1.0'微信

sdkVersion:'8'app

targetSdkVersion:'21'工具

application-label:'鎺屼腑搴嗛槼'ui

application-icon-120:'res/drawable-ldpi-v4/ic_launcher.png'编码

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

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

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

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

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 就能够了。

相关文章
相关标签/搜索