我正在尝试使用robotium为Android原生应用程序制作测试用例。但对于某些应用程序,我收到错误“签名与目标包不匹配”。 有没有办法知道用于Android原生应用程序的签名?
答案 0 :(得分:1)
我建议你使用它:http://www.troido.de/re-sign.jar(以root或管理员身份运行)来重新签名您的应用程序,使用您的调试密钥库对其进行签名。 在本文档中,您将找到有关所有过程的更多信息! 抱歉我的英文!
答案 1 :(得分: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
祝你好运!