2012-07-17 56 views
1

我想爲使用robotium的android本機應用程序製作測試用例。但是對於某些應用程序,我收到一個錯誤消息「簽名與目標軟件包不匹配」。 是否有任何可能的方法來知道用於android原生應用程序的簽名?用於android的簽名本機應用程序

回答

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 

祝您好運!

1

我建議你使用這個:http://www.troido.de/re-sign.jar(以root用戶或管理員身份運行)來退出應用程序,並使用調試密鑰庫對其進行簽名。 在本文檔中,您可以找到有關所有過程的更多信息! 對不起,我的英語!

相關問題