android - 使用 Jenkins 签署应用程序

标签 android ant utf-8 character-encoding jenkins

通常我通过 Eclipse 使用 Android Tools -> Export Signed Application 对我的应用程序进行签名。

现在,我想使用 Jenkins 自动构建和签署我的应用程序。 因此,我在 Mac Mini 上安装了 Jenkins,并使用我的 keystore 凭据创建了一个文件 ant.properties。但是使用 Jenkins 签署我的应用程序失败了:

BUILD FAILED
The following error occurred while executing this line:
Keystore was tampered with, or password was incorrect: Password verification failed

目前我有 2 个问题可能导致签名失败:

1) 我的别名包含一个空格

但是因为我使用了“”(引号),所以我不认为这应该是问题所在。

2) 我的 Keystorepass 包含一个非 utf8 字符

这是我的 ant.properties 文件,用于与 Jenkins 签名 ant.properties:

key.store=mykey.store
key.alias="My Alias"
key.store.password=*€*
key.alias.password=***

如您所见,我有一个非 utf8 字符,我认为这是导致签名过程失败的原因。使用 Eclipse 时,我只需复制并粘贴我的密码,一切都会按预期进行。但是对于 Jenkins,它每次都会失败。

到目前为止已尝试:

我尝试通过命令行(在 Windows 7 上)和 jarsigner 手动签署我的应用程序,使用此行(注意,当我粘贴密码时,€ 符号在我的 Windows 7 cmd 行上被替换为 ?):

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mykey.store MyApp.apk "My Alias" -storepass *?* -keypass ***

这行得通。

但是,我的 Jenkins 安装在 mac mini 上运行,相同的命令要求我输入我的 keystore 密码。当我输入我的通行证或复制/粘贴它时,出现以下错误:

RuntimeException: keystore load: keystore was tampered with, or password was incorrect

奇怪

由于密码是非utf8字符,所以复制粘贴时在各个平台上的显示都不一样。例如。目前我看到了以下字符:

WINDOWS TXT FILE (ORIGINAL): *€*
WINDOWS PASTE IN CMD: *?*
MACMINI OPEN ORIGINAL FILE: *Ä*

有什么建议吗?

最佳答案

.properties 文件需要采用 ISO-8859-1 编码,因此值得仔细检查文件中是否没有 UTF-8(或其他)编码字符,并确保使用了正确的转义码。

来自 Wikipedia :

The encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-Latin-1 characters must be entered by using Unicode escape characters, e.g. \uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set.

关于android - 使用 Jenkins 签署应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20799932/

相关文章:

android - 具有一行而不是两行文本的线性布局中按钮的奇怪行为

java - 全屏 Activity android 3.3

jsp - 在 Apache Tomcat 8.0.12 中编译 JSP 时出错

java - 如何强制ant打印junit的报告带颜色

ant - 用于 Javac 任务的 Ant 中的 ClassPath

iphone - 使用 VBA 和 CDO 邮件对象通过 SMS 将向上箭头 `↑` 字符发送到 iPhone

android - 从 Eclipse 调试 Honeywell Dolphin

android - 可以使用来自耳机插孔的音频吗?

mysql - UTF 8 - 错误 1366 (HY000) - 数据插入时的字符串值不正确

json - 德尔福7 : deal with utf-8 data in JSON response read from website