Need help to resolve System.InvalidOperationException

212 views
Skip to first unread message

Tejas Sutar

unread,
Aug 6, 2014, 8:40:54 AM8/6/14
to appium-...@googlegroups.com
I am recent noob in using Appium. I am writing tests in C#. I was able to run tests successfully a while before. Later I disconnected the device and connected again after some time for running tests. All of a sudden I started getting exception for unknown reason. I am not able to figure what is happening. Below are the exception details:

Exception: System.InvalidOperationException
MessageA new session could not be created. (Original error: java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation} from pid=5645, uid=5645 not allowed because package com.significantdigits.mediwatchreceptionist.selendroid does not have a signature matching the target com.significantdigits.mediwatchreceptionist) (33)
Stack Trace   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Appium.AppiumDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Appium.AppiumDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout)
   at MediWatch.ReceptionistApp.Tests.TestBase.BeforeAll() in d:\TejasWork [MediWatchNew]\Trunk\Src\MediWatch\MediWatch.ReceptionistApp.Tests\TestBase.cs:line 30

Below are the log statements on Appium server:

> Checking if an update is available
> Update not available
> Starting Node Server
> info: Welcome to Appium v1.2.0 (REV e53f49c706a25242e66d36685c268b599cc18da5)
> debug: Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"17","automationName":"Selendroid"}
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.2.2","platformName":"Android","deviceName":"iBall Slide 1","appActivity":".LoginActivity","app":"C:\\Development\\adt-bundle-windows-x86_64-20130522\\sdk\\build-tools\\android-4.2.2\\MediWatchReceptionist.apk"}}
> debug: Appium request initiated at /wd/hub/session
> debug: Request received with params: {"desiredCapabilities":{"platformVersion":"4.2.2","platformName":"Android","deviceName":"iBall Slide 1","appActivity":".LoginActivity","app":"C:\\Development\\adt-bundle-windows-x86_64-20130522\\sdk\\build-tools\\android-4.2.2\\MediWatchReceptionist.apk"}}
> debug: No appPackage desired capability or server param. Parsing from apk.
> debug: Using local app from desired caps: C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk
> info: Retrieving device
> debug: Creating new appium session a1ac787a-42c9-4c4b-ada0-75e6253bfe72
> debug: Starting selendroid server
> debug: Checking whether selendroid is built yet
> debug: Selendroid server exists!
> debug: Preparing device for session
> debug: Checking whether app is actually present
> debug: Checking whether adb is present
> debug: Using adb from C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe
> debug: Trying to find a connected android device
> debug: Getting connected devices...
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" devices
> debug: 2 device(s) connected
> info: Found device emulator-5554
> debug: Setting device id to emulator-5554
> debug: Waiting for device to be ready and to respond to shell commands (timeout = 5)
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 wait-for-device
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
> debug: Starting logcat capture
> debug: Parsing package and activity from app manifest
> debug: Checking whether aapt is present
> debug: Using aapt from C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\aapt.exe
> debug: packageAndLaunchActivityFromManifest: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\aapt.exe" dump badging C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk
> debug: badging package: com.significantdigits.mediwatchreceptionist
> debug: badging act: com.significantdigits.mediwatchreceptionist.SplashActivity
> debug: Parsed package and activity are: com.significantdigits.mediwatchreceptionist/com.significantdigits.mediwatchreceptionist.SplashActivity
> debug: Rebuilt selendroid apk exists, doing nothing
> debug: Rebuilt selendroid server already exists, no need to rebuild it with a new manifest
> debug: Checking signed status of C:\Windows\Temp\selendroid.com.significantdigits.mediwatchreceptionist.apk
> debug: Checking app cert for C:\Windows\Temp\selendroid.com.significantdigits.mediwatchreceptionist.apk: java -jar "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" "C:\Windows\Temp\selendroid.com.significantdigits.mediwatchreceptionist.apk"
> debug: Checking signed status of C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk
> debug: Checking app cert for C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk: java -jar "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk"
> debug: App already signed.
> debug: Zip-aligning C:\Windows\Temp\selendroid.com.significantdigits.mediwatchreceptionist.apk
> debug: Checking whether zipalign is present
> debug: Using zipalign from C:\Development\adt-bundle-windows-x86_64-20130522\sdk\tools\zipalign.exe
> debug: zipAlignApk: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\tools\zipalign.exe" -f 4 "C:\Windows\Temp\selendroid.com.significantdigits.mediwatchreceptionist.apk" "C:\Users\Tejas\AppData\Local\Temp\appium11476-14204-1shgp6.tmp"
> debug: App already signed.
> debug: Zip-aligning C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk
> debug: Checking whether zipalign is present
> debug: Using zipalign from C:\Development\adt-bundle-windows-x86_64-20130522\sdk\tools\zipalign.exe
> debug: zipAlignApk: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\tools\zipalign.exe" -f 4 "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk" "C:\Users\Tejas\AppData\Local\Temp\appium11476-14204-123e1dj.tmp"
> debug: Getting install status for com.significantdigits.mediwatchreceptionist.selendroid
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.significantdigits.mediwatchreceptionist.selendroid"
> debug: App is installed
> debug: Rebuilt selendroid is already installed
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "getprop persist.sys.language"
> debug: Current device language: en
> debug: java -jar "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\jars\strings_from_apk.jar" "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk" "C:\Windows\Temp\com.significantdigits.mediwatchreceptionist" en
> debug: No strings.xml for language 'en', getting default strings.xml
> debug: java -jar "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\jars\strings_from_apk.jar" "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk" "C:\Windows\Temp\com.significantdigits.mediwatchreceptionist"
> debug: Not uninstalling app since server not started with --full-reset
> debug: Checking app cert for C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk: java -jar "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk"
> debug: App already signed.
> debug: Zip-aligning C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk
> debug: Checking whether zipalign is present
> debug: Using zipalign from C:\Development\adt-bundle-windows-x86_64-20130522\sdk\tools\zipalign.exe
> debug: zipAlignApk: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\tools\zipalign.exe" -f 4 "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\build-tools\android-4.2.2\MediWatchReceptionist.apk" "C:\Users\Tejas\AppData\Local\Temp\appium11476-14204-dgtpsb.tmp"
> debug: MD5 for app is 4afe6ec0b2af1260f766040bd104daa2
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/4afe6ec0b2af1260f766040bd104daa2.apk"
> debug: Getting install status for com.significantdigits.mediwatchreceptionist
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.significantdigits.mediwatchreceptionist"
> debug: App is installed
> info: App is already installed, resetting app
> debug: Running fast reset (stop and clear)
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "am force-stop com.significantdigits.mediwatchreceptionist"
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm clear com.significantdigits.mediwatchreceptionist"
> debug: Forwarding system:8080 to device:8080
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 forward tcp:8080 tcp:8080
> debug: Pushing settings apk to device...
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 install "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
> debug: Pushing unlock helper app to device...
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 install "C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window"
> debug: Writing dumpsys output to C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\.dumpsys.log
> debug: Screen already unlocked, continuing.
> debug: executing: "C:\Development\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb.exe" -s emulator-5554 shell "am instrument -e main_activity 'com.significantdigits.mediwatchreceptionist.LoginActivity' com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation"
> error: java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation} from pid=5645, uid=5645 not allowed because package com.significantdigits.mediwatchreceptionist.selendroid does not have a signature matching the target com.significantdigits.mediwatchreceptionist
> at android.os.Parcel.readException(Parcel.java:1425)
> at android.os.Parcel.readException(Parcel.java:1379)
> at android.app.ActivityManagerProxy.startInstrumentation(ActivityManagerNative.java:2871)
> at com.android.commands.am.Am.runInstrument(Am.java:675)
> at com.android.commands.am.Am.run(Am.java:119)
> at com.android.commands.am.Am.main(Am.java:82)
> at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
> at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
> at dalvik.system.NativeStart.main(Native Method)
> info: <-- POST /wd/hub/session 500 17604.082 ms - 880 
> debug: Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation} from pid=5645, uid=5645 not allowed because package com.significantdigits.mediwatchreceptionist.selendroid does not have a signature matching the target com.significantdigits.mediwatchreceptionist
> debug: Error: java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation} from pid=5645, uid=5645 not allowed because package com.significantdigits.mediwatchreceptionist.selendroid does not have a signature matching the target com.significantdigits.mediwatchreceptionist
>     at C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1353:17
>     at C:\Users\Tejas\Desktop\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:162:5
>     at ChildProcess.exithandler (child_process.js:635:7)
>     at ChildProcess.EventEmitter.emit (events.js:98:17)
>     at maybeClose (child_process.js:743:16)
>     at Process.ChildProcess._handle.onexit (child_process.js:810:5)
> debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation} from pid=5645, uid=5645 not allowed because package com.significantdigits.mediwatchreceptionist.selendroid does not have a signature matching the target com.significantdigits.mediwatchreceptionist\r\r)","origValue":"java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.significantdigits.mediwatchreceptionist.selendroid/io.selendroid.ServerInstrumentation} from pid=5645, uid=5645 not allowed because package com.significantdigits.mediwatchreceptionist.selendroid does not have a signature matching the target com.significantdigits.mediwatchreceptionist\r\r"},"sessionId":null}



Please help me get rid of this exception. I am stuck. Any help will be greatly appreciated.

Isaac Murchie

unread,
Aug 6, 2014, 12:23:24 PM8/6/14
to Tejas Sutar, appium-...@googlegroups.com
I would delete the app from the device and see if it helps. 

Is the app signed with a custom keystore? 


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.

Tejas Sutar

unread,
Aug 7, 2014, 12:39:09 AM8/7/14
to appium-...@googlegroups.com, tejas....@gmail.com
Thanks @Isaac Murchie. Deleting app from device helped.
Reply all
Reply to author
Forward
0 new messages