title: Selendroid server can't start on device: Permission Denial: starting instrumentation
body: <p>Looking at automating our android device testing using Selendroid. As I'm just at the research phase I'm using the selendroid-test-app downloaded from their website.</p>
  
  <p>I recently got a new machine. My code and setup worked just fine on the previous one. </p>
  
  <p>My JAVA_HOME is set to: <code>C:\Program Files\Java\jdk1.8.0_45</code>
  My ANDROID_HOME is <code>C:\Program Files (x86)\Android\android-sdk</code>
  I start up the selendroid standalone by running the following command in a console in a local directory:</p>
  
  <p><code>java -jar selendroid-standalone-0.15.0-with-dependencies.jar -app selendroid-test-app-0.15.0.apk</code></p>
  
  <p>This signs the apk fine:</p>
  
  <pre><code>INFO: Executing shell command: C:\Program Files\Java\jdk1.8.0_45\bin\jarsigner.exe -sigalg MD5withRSA -digestalg SHA1 -signedjar c:\SeleniumDrivers\resigned-selendroid-test-app-0.15.0.apk -storepass android -keystore C:\Users\rekab\.android\debug.keystore c:\SeleniumDrivers\selendroid-test-app-0.15.0.apk androiddebugkey
  Jun 12, 2015 8:16:14 AM io.selendroid.standalone.io.ShellCommand exec
  INFO: Shell command output
  --&gt;
  jar signed.
  </code></pre>
  
  <p>Then I start the tests from Visual Studio (C#):
  </p>
  
  <pre><code>DesiredCapabilities caps = DesiredCapabilities.Android();
  caps.SetCapability("browserName", "selendroid");
  caps.SetCapability("aut", "io.selendroid.testapp:0.15.0");  
  
  TouchCapableRemoteWebDriver driver = new TouchCapableRemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), caps);
  </code></pre>
  
  <p>TouchCapableRemoteWebDriver is a wrapper around RemoteWebDriver implementing IHasTouchScreen.</p>
  
  <p>When the driver is getting created, selendroid-test-app gets installed on the phone fine:</p>
  
  <pre><code>INFO: Executing shell command: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s FA34HW903620 install -r c:\SeleniumDrivers\resigned-selendroid-test-app-0.15.0.apk
  Jun 12, 2015 8:17:52 AM io.selendroid.standalone.io.ShellCommand exec
  INFO: Shell command output
  --&gt;
  pkg: /data/local/tmp/resigned-selendroid-test-app-0.15.0.apk
  Success
  rm failed for -f, No such file or directory
  3560 KB/s (511417 bytes in 0.140s)
  &lt;--
  Jun 12, 2015 8:17:53 AM io.selendroid.standalone.io.ShellCommand exec
  INFO: Executing shell command: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s FA34HW903620 shell pm list packages io.selendroid.io.selendroid.testapp
  Jun 12, 2015 8:17:54 AM io.selendroid.standalone.io.ShellCommand exec
  INFO: Shell command output
  --&gt;
  package:io.selendroid.io.selendroid.testapp
  &lt;--
  </code></pre>
  
  <p>However, when it gets to starting the instrumentation I get an exception:</p>
  
  <pre><code>INFO: Executing shell command: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s FA34HW903620 shell am instrument -e main_activity io.selendroid.testapp.HomeScreenActivity -e server_port 8080 io.selendroid.io.selendroid.testapp/io.selendroid.server.ServerInstrumentation
  Jun 12, 2015 8:17:55 AM io.selendroid.standalone.io.ShellCommand exec
  INFO: Shell command output
  --&gt;
  java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{io.selendroid.io.selendroid.testapp/io.selendroid.server.ServerInstrumentation} from pid=26099, uid=26099 not allowed because package io.selendroid.io.selendroid.testapp does not have a signature matching the target io.selendroid.testapp
          at android.os.Parcel.readException(Parcel.java:1430)
          at android.os.Parcel.readException(Parcel.java:1384)
          at android.app.ActivityManagerProxy.startInstrumentation(ActivityManagerNative.java:2839)
          at com.android.commands.am.Am.runInstrument(Am.java:615)
          at com.android.commands.am.Am.run(Am.java:118)
          at com.android.commands.am.Am.main(Am.java:81)
          at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
          at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:257)
          at dalvik.system.NativeStart.main(Native Method)
  &lt;--
  </code></pre>
  
  <p>Obviously, the test can't start. What's going wrong? Even with the new machine this was working up till the point when I uninstalled the app from the phone and ran the test again. It now gets re-installed but the server on the phone can't start?</p>
  
  <p>Thanks for any help!</p>