使用 Eclipse 如何给 APK 签名呢?下面就跟随小编一起来学习使用 Eclipse给 APK 签名教程,熟悉一下它的操作流程吧。
一、strings.xml 的翻译问题
在你的项目名字上面点鼠标右键,弹出下面的菜单,选择 Android Tools -> Export Signed Application Package... ,

然后会看到这么一个提示:

并且得到下面这样的错误描述:

大意是,导出操作因为 Lint Error Checking (检测 Lint 错误) 出现致命错误而退出,请修正这些错误再运行导出,或者在设置里的 Android -> Lint Error Checking 页面里把 “Run full error check when exporting app” 把选项关掉。
而错误描述里面的说的是,strings.xml 里面的 app_name 缺少 af(Afrikaans), am(Amharic), ar, bg, bn-rBD, ca, cs, da, de ... 等语言的翻译,这个可能跟创建工程时自动生成的项目 appcompat_v7 里的 strings.xml 的语言数量有关,我们当然不希望每种语言都翻译一遍啊,纯属吃多了,除非我们真的想每种语言都翻译。
另一方面,我们也不希望关掉所有的 Lint Error Checking,所以我们可以这么做,打开eclipse 菜单的 Windows -> Perferences,
切换到 Android -> Lint Error Checking 子项下面,下面这是 Missing Translation 的默认设置:

我们可以把这一项的 Severity 由 Fatal (致命) 修改为 Ignore(忽略) 或者 Warning(警告),如下图:

另:关于多语言翻译的问题,有一个问题是值得关注的,例如:《Android翻译多国语言字符串注意事项》。
二、签名 keystore 的逗号问题
点击确定,然后重新开始前面的步骤,开始导出,这次可以了,下面是导出的界面,选择你要导出的项目:

后面就是选择 keystore ,你可以选择已经存在的 keystore 或者新建一个 keystore,我选择新建,输入密码,然后进入下面这个设置界面:

下一步,最后生成的时候,我们得到这样一个错误:

Google 一下,找到这么一篇: 《keytool 错误: java.io.IOException: Incorrect AVA format》,stackoverflow 上也有类似的讨论:keytool error :java.io.IoException:Incorrect AVA format ,结论都是一样的,原来原因竟然是因为 “,”(逗号) 被认为是特殊字符,这通常发生在书写 “City or Locality” 时,按我们平时的习惯都会写成 “Beijing, China”,而我也不例外的写成了 “GuangXi, China” ,所以就出错了,找到原因,去掉逗号再试,就 OK 了。
除了用 Eclipse 以外,还有一种签名方法,就是使用 Keytool 和 Jarsigner 给 app 签名,而这种签名是允许加入这个逗号的,《keytool 错误: java.io.IOException: Incorrect AVA format》 里有提到。
这里贴一个 keytool 关于特殊字符的说明及用法,摘自://www.oschina.net/question/163910_29310,
特殊字符还包括,加号(+),引号("),斜杠(),大于小于号(< 和 >),分号(;) 等,解决的办法是用 转义符。

以上就是使用 Eclipse给 APK 签名教程,希望可以帮助到大家。