Starting Appium Programmatically - Connection Refused (Connection Refused)
See original GitHub issueDescription
@SrinivasanTarget @mykola-mokhnach @TikhomirovSergey @jlipps
I am trying to start Appium programatically and pass its IP and Port into AppiumDriver
Before I pass it to the driver, I sys.out.println the Appium Service’s IP/Port it is running on to the console, and it is 0.0.0.0:4723.
Yet, I am getting a Connection Refused after passing it to driver (See stack trace). If I manually start Appium, it is starting on 0.0.0.0:4723, just fine.
Please find my code and StackTrace below. I really need help. Many thanks.
Environment
- java client build version or git revision if you use some shapshot:
- Appium server version or git revision if you use some shapshot: 5.0.1 Java-client
- Desktop OS/version used to run Appium if necessary: Ubuntu16
- Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
- Mobile platform/version under test: Nexus5 Kitkat
- Real device or emulator/simulator:
Details
Please provide more details, if necessary.
Code To Reproduce Issue [ Good To Have ]
public class AppiumServerJava {
public AppiumDriverLocalService service;
public AppiumServiceBuilder builder;
public DesiredCapabilities cap;
public DesiredCapabilities dc;
AppiumDriver<MobileElement> driver;
File root = new File(System.getProperty("user.dir"));
File app = new File(root, "/src/test/api/app-qa.apk");
public AppiumDriver<MobileElement> startServer() {
// apk Capabilities
dc = new DesiredCapabilities();
dc.setCapability("BROWSER_NAME", "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID);
dc.setCapability("deviceName", "nexus5");
dc.setCapability("app", app.getAbsolutePath());
dc.setCapability("appPackage", "com.aa.android.qa");
dc.setCapability("appActivity", "com.aa.android.view.SplashActivity");
// Appium Capabilities
cap = new DesiredCapabilities();
cap.setCapability("noReset", "false");
// Build the Appium Service
builder = new AppiumServiceBuilder();
builder.usingDriverExecutable(new File("/home/ninad/.linuxbrew/bin/node"));
builder.withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"));
builder.withIPAddress("127.0.0.1");
/*builder.usingPort(4723);*/
builder.usingAnyFreePort();
builder.withCapabilities(cap);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL, "error");
// Start the server with the builder
try {
service = AppiumDriverLocalService.buildService(builder);
service.start();
} catch (NullPointerException e) {
e.printStackTrace();
}
System.out.println("Appium URL " + service.getUrl().toString());
driver = new AndroidDriver<MobileElement>(service.getUrl(), dc);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
return driver;
}
public void stopServer() {
service.stop();
}
public boolean checkIfServerIsRunnning(int port) {
boolean isServerRunning = false;
ServerSocket serverSocket;
try {
serverSocket = new ServerSocket(port);
serverSocket.close();
} catch (IOException e) {
// If control comes here, then it means that the port is in use
isServerRunning = true;
} finally {
serverSocket = null;
}
return isServerRunning;
}
}
```
AppiumServerJava appiumServer = new AppiumServerJava(); AppiumDriver<MobileElement> driver;
@Before("@setup")
public void setUp() {
int port = 4723;
try {
if (!appiumServer.checkIfServerIsRunnning(port)) {
appiumServer.startServer();
appiumServer.stopServer();
} else {
System.out.println("Appium Server already running on Port - " + port);
}
} catch (NullPointerException e) {
e.printStackTrace();
}
driver = appiumServer.startServer();
}
## Exception stacktraces
Appium URL http://0.0.0.0:4723/wd/hub Failure in before hook:StepDefinitions.setUp() Message: org.openqa.selenium.WebDriverException: Connection refused (Connection refused) Build info: version: ‘3.5.2’, revision: ‘10229a9’, time: ‘2017-08-21T17:29:55.15Z’
System info: host: ‘ninad-Gazelle’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.10.0-42-generic’, java.version: ‘1.8.0_151’ Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor.lambda$2(AppiumCommandExecutor.java:101) at java.util.Optional.orElseGet(Optional.java:267) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:100) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:254) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137) at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:87) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:111) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:72) at Utilities.AppiumServerJava.startServer(AppiumServerJava.java:66) at mobileTest.appiumSeleniumCucumberAndroid.StepDefinitions.setUp(StepDefinitions.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at cucumber.runtime.Utils$1.call(Utils.java:40) at cucumber.runtime.Timeout.timeout(Timeout.java:16) at cucumber.runtime.Utils.invoke(Utils.java:34) at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60) at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224) at cucumber.runtime.Runtime.runHooks(Runtime.java:212) at cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:202) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:40) at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165) at cucumber.runtime.Runtime.run(Runtime.java:122) at cucumber.api.cli.Main.run(Main.java:36) at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:204) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:139) at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:87) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:337) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89) … 29 more
## Link to Appium logs
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
org.openqa.selenium.WebDriverException: Connection refused Build info: version: ‘3.6.0’, revision: ‘6fbf3ec767’, time: ‘2017-09-27T15:28:36.4Z’ System info: host: ‘bogon’, ip: ‘fe80:0:0:0:416:3365:c633:552f%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.12.4’, java.version: ‘1.8.0_112-release’ Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor.lambda$2(AppiumCommandExecutor.java:101) at java.util.Optional.orElseGet(Optional.java:267) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:100) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140) at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:83) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:93) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:72) at MobileFindJavaTest.setUp(MobileFindJavaTest.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:156) at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:86) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:337) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89) … 39 more
log: [info] [Appium] Welcome to Appium v1.7.2 [info] [Appium] Appium REST http interface listener started on 0.0.0.0:4723[info] [HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“appPackage”:“com.cc.app”,“appActivity”:“com.cc.custom.MainActivity”,“app”:“/Users/Cheng/github/CustomViews/app/app-debug.apk”,“platformName”:“Android”,“deviceName”:“Nexus”},“requiredCapabilities”:{},“capabilities”:{“desiredCapabilities”:{“appPackage”:“com.cc.app”,“appActivity”:“com.cc.custom.MainActivity”,“app”:“/Users/Cheng/github/CustomViews/app/app-debug.apk”,“platformName”:“Android”,“deviceName”:“Nexus”},“requiredCapabilities”:{},“alwaysMatch”:{“platformName”:“Android”},“firstMatch”:[]}} [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“appPackage”:“com.cc.app”,“appActivity”:“com.cc.custom.MainActivity”,“app”:“/Users/Cheng/github/CustomViews/app/app-debug.apk”,“platformName”:“Android”,“deviceName”:“Nexus”},{},{“desiredCapabilities”:{“appPackage”:“com.cc.app”,“appActivity”:“com.cc.custom.MainActivity”,“app”:“/Users/Cheng/github/CustomViews/app/app-debug.apk”,“platformName”:“Android”,“deviceName”:“Nexus”},“requiredCapabilities”:{},“alwaysMatch”:{“platformName”:“Android”},“firstMatch”:[]}] [debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1517278119140 (10:08:39 GMT+0800 (CST)) [info] [Appium] Merged W3C capabilities {“desiredCapabilities”:{“appPackage”:“com.cc.ap… into desiredCapabilities object {“appPackage”:“com.cc.app”,“appActivity”:“com.c… [info] [Appium] Creating new AndroidDriver (v1.37.0) session [info] [Appium] Capabilities: [info] [Appium] appPackage: com.cc.app [info] [Appium] appActivity: com.cc.custom.MainActivity [info] [Appium] app: /Users/Cheng/github/CustomViews/app/app-debug.apk [info] [Appium] platformName: Android [info] [Appium] deviceName: Nexus [info] [BaseDriver] Session created with session id: 2cdaa9e0-55d4-4efd-b592-db50f0abfc6d [debug] [AndroidDriver] Getting Java version[info] [AndroidDriver] Java version is: 1.8.0_74 [info] [ADB] Checking whether adb is present [info] [ADB] Using adb from /Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb [info] [AndroidDriver] Retrieving device list [debug] [ADB] Trying to find a connected android device [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [info] [AndroidDriver] Using device: 03a6904b251a4850 [info] [ADB] Checking whether adb is present [debug] [ADB] Setting device id to 03a6904b251a4850 [info] [BaseDriver] Using local app ‘/Users/Cheng/github/CustomViews/app/app-debug.apk’ [debug] [AndroidDriver] Checking whether app is actually present [info] [AndroidDriver] Starting Android session [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [”-P”,5037,“-s”,“03a6904b251a4850”,“wait-for-device”] [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“echo”,“ping”] [warn] [AndroidDriver] setDeviceLanguageCountry requires language or country. [warn] [AndroidDriver] Got language: ‘undefined’ and country: ‘undefined’ [debug] [Logcat] Starting logcat capture[debug] [AndroidDriver] Pushing settings apk to device… [debug] [ADB] Getting install status for io.appium.settings [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“pm”,“list”,“packages”,“io.appium.settings”][debug] [ADB] App is installed [debug] [ADB] Getting package info for io.appium.settings [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“dumpsys”,“package”,“io.appium.settings”] [info] [ADB] Checking whether aapt is present [info] [ADB] Using aapt from /Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/build-tools/25.0.2/aapt [debug] [ADB] The installed ‘io.appium.settings’ package does not require upgrade (5 >= 5) [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“getprop”,“ro.build.version.sdk”][debug] [ADB] Current device property ‘ro.build.version.sdk’: 23 [debug] [ADB] Device API level: 23 [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“dumpsys”,“package”,“io.appium.settings”] [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“pm”,“dump”,“io.appium.settings”][debug] [ADB] Got the following command chunks to execute: pm,grant,io.appium.settings,android.permission.WRITE_SETTINGS,;,pm,grant,io.appium.settings,android.permission.ACCESS_MOCK_LOCATION,; [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“pm”,“grant”,“io.appium.settings”,“android.permission.WRITE_SETTINGS”,“;”,“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_MOCK_LOCATION”,“;”][debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“ps”] [debug] [ADB] Device API level: 23 [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“appops”,“set”,“io.appium.settings”,“android:mock_location”,“allow”][debug] [AndroidDriver] Pushing unlock helper app to device… [debug] [ADB] Getting install status for io.appium.unlock [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“pm”,“list”,“packages”,“io.appium.unlock”][debug] [ADB] App is installed [debug] [ADB] Getting package info for io.appium.unlock [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“dumpsys”,“package”,“io.appium.unlock”] [info] [ADB] Checking whether aapt is present[debug] [ADB] The installed ‘io.appium.unlock’ package is older than ‘/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk’ (1 < 2). Executing upgrade [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“install”,“-r”,“/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk”][info] [ADB] Getting device platform version [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“getprop”,“ro.build.version.release”] [debug] [ADB] Current device property ‘ro.build.version.release’: 6.0.1 [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“wm”,“size”][debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“getprop”,“ro.product.model”][debug] [ADB] Current device property ‘ro.product.model’: Nexus 5 [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“getprop”,“ro.product.manufacturer”] [debug] [ADB] Current device property ‘ro.product.manufacturer’: LGE [info] [AndroidDriver] Remote apk path is /data/local/tmp/563f87e2a27ebac81f6cb3480b823ff8.apk [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“ls”,“/data/local/tmp/563f87e2a27ebac81f6cb3480b823ff8.apk”] [debug] [AndroidDriver] Checking if app is installed [debug] [ADB] Getting install status for com.cc.app [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“pm”,“list”,“packages”,“com.cc.app”][debug] [ADB] App is installed [info] [AndroidDriver] Apk is already on remote and installed, resetting [debug] [AndroidDriver] Running fast reset (stop and clear) [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“am”,“force-stop”,“com.cc.app”][debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“pm”,“clear”,“com.cc.app”][debug] [AndroidDriver] Extracting strings from apk /Users/Cheng/github/CustomViews/app/app-debug.apk undefined /var/folders/bd/7m3d7zys3sq4hpfhjr6cbl0w0000gn/T/com.cc.app [debug] [ADB] Extracting strings for language: default [debug] [ADB] Device API level: 23 [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“getprop”,“persist.sys.locale”] [debug] [ADB] Current device property ‘persist.sys.locale’: zh-CN[debug] [ADB] No strings.xml for language ‘zh’, getting default strings.xml[debug] [ADB] Reading strings from converted strings.json [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“push”,“/var/folders/bd/7m3d7zys3sq4hpfhjr6cbl0w0000gn/T/com.cc.app/strings.json”,“/data/local/tmp”] [debug] [AndroidBootstrap] Watching for bootstrap disconnect [debug] [ADB] Forwarding system: 4724 to device: 4724 [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“forward”,“tcp:4724”,“tcp:4724”] [debug] [UiAutomator] Starting UiAutomator [debug] [UiAutomator] Moving to state ‘starting’ [debug] [UiAutomator] Parsing uiautomator jar [debug] [UiAutomator] Found jar name: ‘AppiumBootstrap.jar’ [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“push”,“/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-android-bootstrap/bootstrap/bin/AppiumBootstrap.jar”,“/data/local/tmp/”] [debug] [ADB] Attempting to kill all uiautomator processes [debug] [ADB] Getting all processes with uiautomator [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“ps”] [debug] [ADB] Attempting to kill process 18318 [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“kill”,“-0”,18318] [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“kill”,18318][debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“kill”,18318][debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“kill”,18318][debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“kill”,18318] [warn] [ADB] Cannot kill process 18318 in 1000 ms. Trying to force kill… [debug] [ADB] Getting connected devices… [debug] [ADB] 1 device(s) connected [debug] [ADB] Running ‘/Users/Cheng/adt/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb’ with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“kill”,“-9”,18318] [debug] [UiAutomator] Starting UIAutomator [debug] [ADB] Creating ADB subprocess with args: [“-P”,5037,“-s”,“03a6904b251a4850”,“shell”,“uiautomator”,“runtest”,“AppiumBootstrap.jar”,“-c”,“io.appium.android.bootstrap.Bootstrap”,“-e”,“pkg”,“com.cc.app”,“-e”,“disableAndroidWatchers”,false,“-e”,“acceptSslCerts”,false]
I got this error, and tried restarting my computer, which has worked before, but not this time. So I just changed the port, so now it runs again. Not a solution, but an easy workaround.