aapt解析的坑,记录一下防止再次掉入
2016-12-05 21:13
281 查看
在将app发布到各大市场上之前我们需要自己在本地用aapt解析一遍上传的apk文件,当然你也可以选择等各大市场将你的apk打回来之后再去检查原因,好了,进入正题,解析apk时提示“ERROR getting 'android:icon' attribute: attribute is not a stringvalue”或者“ERROR getting 'android:label' attribute: attribute is not a stringvalue”,android清单文件中label有两种引用方式一种是硬编码一种是资源引用,无论是报上面哪种错误在我看来都是label的错,当清单文件有多个android:label的时候请使用:
要注意检查的是清单文件中的所有资源引用类似于@string的android:label都需要转化成硬编码,至于icon在清单文件中只能以资源引用的方式存在,无需理会,下面提供一下本地aapt解析apk的方法:1.找到自己本地sdk下build-tools的文件夹,打开命令行,进入build-tools文件夹目录,执行aapt dump badging .apk2.查看是否有报错信息,若看得太吃力可以使用aapt dump badging .apk >1.txt将数据打印到文本中观看好了,就这么点内容了
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="xxxxx">
<application android:name=".xxxx" android:allowBackup="true" android:icon="@drawable/icon" android:label="应用名硬编码" android:largeHeap="true" android:supportsRtl="true" android:theme="@style/AppTheme" tools:replace="android:label" >
要注意检查的是清单文件中的所有资源引用类似于@string的android:label都需要转化成硬编码,至于icon在清单文件中只能以资源引用的方式存在,无需理会,下面提供一下本地aapt解析apk的方法:1.找到自己本地sdk下build-tools的文件夹,打开命令行,进入build-tools文件夹目录,执行aapt dump badging .apk2.查看是否有报错信息,若看得太吃力可以使用aapt dump badging .apk >1.txt将数据打印到文本中观看好了,就这么点内容了
相关文章推荐
- 今天在看程序,看到了break ,C还不是很好,就查了一下。再次记录一下。以后可以随时查看。
- Oracle解析 xml 记录一下(未完待续)
- 北理工java的试卷总结,我做了一下,发现也有许多以前没有理解的地方,现在再次记录下来
- 再次遇到坑爹的版本问题,记录一下,备忘
- 泛泰A880S再次救砖成功,记录一下
- hash哈希长度扩展攻击解析(记录一下,保证不忘)
- 记录一下在Android使用Json解析字符串
- Android SAX解析远程服务器端的xml,防止解析的时候出现空格或者标点符号再次解析的方法
- 微信支付核心部分,记录在此防止再次被坑
- 宝宝推荐的书记录一下
- classpath 问题,错了好多次,记录一下
- 记录一下进程监控的一种小技巧
- 再次整理了一下主流 Blog 程序
- 记录一下圆周率,最近正在背。
- 自己写的一个JSP小游戏21点,记录一下
- [导入]WebbUpload测试的输入记录,用来安慰一下自己!!
- 再次呼吁一下,加个分页功能吧
- 注册一个月了,一直没有来,今天开始决定记录一下自己的所见所学所感!
- 几个数据仓库方面的资源,记录一下。
- 名词解释: 域名解析 A记录 MX记录 CNAME记录 TTL