使用测试自动化框架Selendroid设置的问题

时间:2014-10-16 07:01:04

标签: java android testing automation selendroid

我在设置Selendroid服务器时遇到问题。 当我运行命令java -jar selendroid-standalone-0.11.0-with-dependencies.jar -app selendroid-test-app-0.11.0.apk时 我收到以下错误:



C:\Users\mawal2\Downloads>java -jar selendroid-standalone-0.11.0-with-dependenci
es.jar -app selendroid-test-app-0.11.0.apk
################# Selendroid #################
################# Configuration in use #################
io.selendroid.SelendroidConfiguration@19469ea2[
  port=4444
  timeoutEmulatorStart=300000
  supportedApps=[selendroid-test-app-0.11.0.apk]
  verbose=false
  emulatorPort=5560
  deviceScreenshot=false
  selendroidServerPort=8080
  keystore=<null>
  emulatorOptions=<null>
  registrationUrl=<null>
  proxy=<null>
  serverHost=<null>
  keepAdbAlive=false
  noWebViewApp=false
  noClearData=false
  sessionTimeoutSeconds=1800
  forceReinstall=false
  logLevel=ERROR
]
Oct 16, 2014 7:57:24 AM io.selendroid.SelendroidLauncher launchServer
INFO: Starting selendroid-server port 4444
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/MANIFEST.MF
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/CERT.RSA
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/CERT.SF
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/ANDROIDD.SF
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/ANDROIDD.RSA
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/NDKEYSTO.SF
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Users\mawal2\Documents\android\adt-bundle-windows-x8
6_64-20140702\sdk\build-tools\android-4.4W\aapt.exe remove C:\Users\mawal2\Downl
oads\selendroid-test-app-0.11.0.apk META-INF/NDKEYSTO.RSA
Oct 16, 2014 7:57:24 AM io.selendroid.io.ShellCommand exec
INFO: executing command: C:\Program Files\Java\jdk1.8.0_20\bin\bin\jarsigner.exe
 -sigalg MD5withRSA -digestalg SHA1 -signedjar C:\Users\mawal2\Downloads\resigne
d-selendroid-test-app-0.11.0.apk -storepass android -keystore C:\Users\mawal2\.a
ndroid\debug.keystore C:\Users\mawal2\Downloads\selendroid-test-app-0.11.0.apk a
ndroiddebugkey
Oct 16, 2014 7:57:24 AM io.selendroid.SelendroidLauncher launchServer
SEVERE: Error occurred while building server: An error occurred while resigning
the app 'selendroid-test-app-0.11.0.apk'.
io.selendroid.exceptions.SessionNotCreatedException: An error occurred while res
igning the app 'selendroid-test-app-0.11.0.apk'.
        at io.selendroid.server.model.SelendroidStandaloneDriver.initApplication
sUnderTest(SelendroidStandaloneDriver.java:114)
        at io.selendroid.server.model.SelendroidStandaloneDriver.<init>(Selendro
idStandaloneDriver.java:82)
        at io.selendroid.server.SelendroidStandaloneServer.initializeSelendroidS
erver(SelendroidStandaloneServer.java:61)
        at io.selendroid.server.SelendroidStandaloneServer.<init>(SelendroidStan
daloneServer.java:50)
        at io.selendroid.SelendroidLauncher.launchServer(SelendroidLauncher.java
:49)
        at io.selendroid.SelendroidLauncher.main(SelendroidLauncher.java:105)
Caused by: io.selendroid.exceptions.ShellCommandException: An error occured whil
e executing shell command: C:\Program Files\Java\jdk1.8.0_20\bin\bin\jarsigner.e
xe -sigalg MD5withRSA -digestalg SHA1 -signedjar C:\Users\mawal2\Downloads\resig
ned-selendroid-test-app-0.11.0.apk -storepass android -keystore C:\Users\mawal2\
.android\debug.keystore C:\Users\mawal2\Downloads\selendroid-test-app-0.11.0.apk
 androiddebugkey
        at io.selendroid.io.ShellCommand.exec(ShellCommand.java:49)
        at io.selendroid.builder.SelendroidServerBuilder.signTestServer(Selendro
idServerBuilder.java:274)
        at io.selendroid.builder.SelendroidServerBuilder.resignApp(SelendroidSer
verBuilder.java:134)
        at io.selendroid.server.model.SelendroidStandaloneDriver.initApplication
sUnderTest(SelendroidStandaloneDriver.java:112)
        ... 5 more
Caused by: io.selendroid.exceptions.ShellCommandException:
        ... 9 more
Exception in thread "main" io.selendroid.exceptions.SessionNotCreatedException:
An error occurred while resigning the app 'selendroid-test-app-0.11.0.apk'.
        at io.selendroid.server.model.SelendroidStandaloneDriver.initApplication
sUnderTest(SelendroidStandaloneDriver.java:114)
        at io.selendroid.server.model.SelendroidStandaloneDriver.<init>(Selendro
idStandaloneDriver.java:82)
        at io.selendroid.server.SelendroidStandaloneServer.initializeSelendroidS
erver(SelendroidStandaloneServer.java:61)
        at io.selendroid.server.SelendroidStandaloneServer.<init>(SelendroidStan
daloneServer.java:50)
        at io.selendroid.SelendroidLauncher.launchServer(SelendroidLauncher.java
:49)
        at io.selendroid.SelendroidLauncher.main(SelendroidLauncher.java:105)
Caused by: io.selendroid.exceptions.ShellCommandException: An error occured whil
e executing shell command: C:\Program Files\Java\jdk1.8.0_20\bin\bin\jarsigner.e
xe -sigalg MD5withRSA -digestalg SHA1 -signedjar C:\Users\mawal2\Downloads\resig
ned-selendroid-test-app-0.11.0.apk -storepass android -keystore C:\Users\mawal2\
.android\debug.keystore C:\Users\mawal2\Downloads\selendroid-test-app-0.11.0.apk
 androiddebugkey
        at io.selendroid.io.ShellCommand.exec(ShellCommand.java:49)
        at io.selendroid.builder.SelendroidServerBuilder.signTestServer(Selendro
idServerBuilder.java:274)
        at io.selendroid.builder.SelendroidServerBuilder.resignApp(SelendroidSer
verBuilder.java:134)
        at io.selendroid.server.model.SelendroidStandaloneDriver.initApplication
sUnderTest(SelendroidStandaloneDriver.java:112)
        ... 5 more
Caused by: io.selendroid.exceptions.ShellCommandException:
        ... 9 more

C:\Users\mawal2\Downloads>
&#13;
&#13;
&#13;

我认为问题与java或android环境变量有关。 我已经阅读了很多指南和论坛帖子并尝试了不同的方法,但我总是得到相同的结果。 env变量目前按以下方式设置: 在&#34;&#34;的用户变量下:

  • ANDROID_HOME:C:\ Users \ mawal2 \ Documents \ android \ adt-bundle-windows-x86_64-20140702 \ sdk

  • JAVA_HOME:C:\ Program Files \ Java \ jdk1.8.0_20 \ bin

&#34; System varibles&#34;:

  • 路径:%SystemRoot%\ system32;%SystemRoot%;%SystemRoot%\ System32 \ Wbem;%SYSTEMROOT%\ System32 \ WindowsPowerShell \ v1.0 \; C:\ Windows \ CCM; C:\ Program Files \ OpenVPN \ BIN; C:\用户\ mawal2 \文件\机器人\ ADT-束 - 窗口x86_64-20140702 \ SDK \工具\; C:\用户\ mawal2 \文件\机器人\ ADT-束 - 窗口x86_64-20140702 \ sdk \ platform-tools \; C:\ Program Files \ Java \ jdk1.8.0_20 \ bin \;

我的操作系统是Windows 8.1企业版

非常感谢我能得到的所有帮助!

最好的问候马格努斯

1 个答案:

答案 0 :(得分:0)

我在An error occured whil e executing shell command: C:\Program Files\Java\jdk1.8.0_20\bin\bin\jarsigner.e xe

时解决了这个问题

彼此之后有bin \ bin不正确。通过将Java home变量更改为: JAVA_HOME:C:\ Program Files \ Java \ jdk1.8.0_20 \

我还注意到,对我来说,只有在重新启动计算机后才进行变量更改,这可能是之前没有设法解决它的原因。