1

我正在尝试使用robotium 为android 本机应用程序制作测试用例。但对于某些应用程序,我收到错误“签名与目标包不匹配”。有没有可能知道要用于 android 本机应用程序的签名的方法?

4

2 回答 2

1

我建议您使用这个:http ://www.troido.de/re-sign.jar (以 root 或管理员身份运行)来为您的应用程序签名,并使用您的调试密钥库对其进行签名。在本文档中,您将找到有关所有程序的更多信息!对不起我的英语不好!

于 2013-07-16T21:58:51.653 回答
0

不适用于本机应用程序。这是 的“问题”Robotium之一,因为签名必须匹配。Robotium声称他们能够进行“黑盒”测试,但您必须有一个匹配的签名,这并不总是可用的。一种选择是您可以尝试删除旧签名,并使用调试签名创建一个新签名。

Robotium以下是可能有帮助的文档的摘录:

    Signature:
The signature will identify the author of the android application. Signature means it contains the information like first name and last name of the developer, Name of the organizational unit, organization, city, state, two-­‐letter country code.
Standard tools like Keytool and Jarsigner are used to generate keys and sign applications. [For more help: http://developer.android.com/guide/publishing/app-­‐signing.html ]
IMPORTANT STEPS:
* If you know the certificate signature then you need to use the same signature in your test project
* If you do not know the certificate signature then you need to delete the certificate signature and you should use the same android debug key signature in both the application and the test project
* If the application is unsigned then you need to sign the application apk with the android debug key
If the application is signed then you can use the following drag and drop java program to resign it:
http://www.troido.de/re-­‐sign.jar
Or
-­‐-­‐ Un-­‐zip the apk file
-­‐-­‐ Delete the META-­‐INF folder
-­‐-­‐ Re-­‐zip the apk file
-­‐-­‐ In Dos prompt /Command prompt
> jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android ApplicationToTest.apk androiddebugkey
> zipalign 4 ApplicationToTest.apk TempApplicationToTest.apk
Then rename TempApplicationToTest.apk to ApplicationToTest.apk

祝你好运!

于 2012-07-20T15:34:14.667 回答