How to submit local apk file to remote appium server?

My setup:

  • PC-1
  • PC-2

PC-1:

  • has apk file
  • executes appium tests against PC-2

PC-2:

  • has only nodejs with appium running

Problem: When I want to run a test

org.openqa.selenium.SessionNotCreatedException: 
A new session could not be created. 
(Original error: Bad app: <<local_path>>myApp.apk. 
App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. 
cause: Error: Error locating the app: 
ENOENT, stat '<<local_path>>myApp.apk') (WARNING: The server did not provide any stacktrace information)

Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'my-PC', ip: 'XXX.XXX.XXX.XXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_55'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)

My Caps:

caps.setCapability("device","android"); caps.setCapability("deviceName","Galaxy S3"); caps.setCapability("platformName","android"); caps.setCapability("version", "4.3"); caps.setCapability("deviceType", "phone"); caps.setCapability(CapabilityType.PLATFORM, "Windows"); caps.setCapability("app-activity", "package.activities.MyActivity_"); caps.setCapability("app-package", "xx.my.myapp"); caps.setCapability("app", app.getAbsolutePath());

-> So how do I sumbit my local APK file from PC-1 to PC-2 where appium is running?

So the error you're getting, Bad App, is because Appium cannot find the .apk that you gave it in the 'app' capability.

The logs show that you're trying to tell Appium that the app is at: <>myApp.apk.

My guess is that your app.getAbsolutePath() function is not returning the path to the .apk

Appium is able to download a compressed .apk file from a url. If you host the .apk on the local network, or network the two computers together somehow, you should be able to point the 'app' capability to that URL.

The test is if you paste the path into your browser window it should take you to download the .apk