I am using Appium: 1.9.1 Selenium 3.12.0 and java-client’, version: ‘6.1.0’ … When i was running my script then Unable to launch app on real device getting an error when running script uncaughtException: Android bootstrap socket crashed: Error: getaddrinfo ENOENT u ndefined:4724
Appium Log:
[HTTP] {“desiredCapabilities”:{“appActivity”:“com.miui.calculator.cal.Calculator
Activity”,“appPackage”:“com.miui.calculator”,“platformVersion”:“8.1.0”,“platform
Name”:“Android”,“udid”:“35924c6f0804”,“deviceName”:“Redmi Note 5”},“capabilities
”:{“alwaysMatch”:{“appium:appActivity”:“com.miui.calculator.cal.CalculatorActivi
ty”,“appium:appPackage”:“com.miui.calculator”,“appium:deviceName”:“Redmi Note 5”
,“platformName”:“android”,“appium:platformVersion”:“8.1.0”,“appium:udid”:“35924c
6f0804”},“firstMatch”:[{}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{“appActivity”:“c
om.miui.calculator.cal.CalculatorActivity”,“appPackage”:“com.miui.calculator”,“p
latformVersion”:“8.1.0”,“platformName”:“Android”,“udid”:“35924c6f0804”,“deviceNa
me”:“Redmi Note 5”},null,{“alwaysMatch”:{“appium:appActivity”:“com.miui.calculat
or.cal.CalculatorActivity”,“appium:appPackage”:“com.miui.calculator”,“appium:dev
iceName”:“Redmi Note 5”,“platformName”:“android”,“appium:platformVersion”:“8.1.0
”,“appium:udid”:“35924c6f0804”},“firstMatch”:[{}]}]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1540239103929 (01:41:
43 GMT+0530 (India Standard Time))
[Appium] Consider setting ‘automationName’ capability to ‘UiAutomator2’ on Andro
id >= 6, since UIAutomator framework is not maintained anymore by the OS vendor.
[Appium] Creating new AndroidDriver (v4.1.1) session
[Appium] Capabilities:
[Appium] platformName: android
[Appium] appActivity: com.miui.calculator.cal.CalculatorActivity
[Appium] appPackage: com.miui.calculator
[Appium] deviceName: Redmi Note 5
[Appium] platformVersion: 8.1.0
[Appium] udid: 35924c6f0804
[debug] [BaseDriver] W3C capabilities {“alwaysMatch”:{“platformNa… and MJSONWP
desired capabilities {“appActivity”:“com.miui.ca… were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {“alwaysMatch”:{“pl
atformNa…
[BaseDriver] Session created with session id: 3fb9f3cb-abce-4ce0-b400-410b3a87d8
a5
[AndroidDriver] Java version is: 1.8.0_91
[ADB] Checking whether adb is present
[ADB] Found 2 ‘build-tools’ folders under ‘C:\Users\Office\AppData\Local\Android
\Sdk’ (newest first):
[ADB] C:/Users/Office/AppData/Local/Android/Sdk/build-tools/28.0.3
[ADB] C:/Users/Office/AppData/Local/Android/Sdk/build-tools/28.0.2
[ADB] Using adb.exe from C:\Users\Office\AppData\Local\Android\Sdk\platform-tool
s\adb.exe
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Using device: 35924c6f0804
[debug] [ADB] Setting device id to 35924c6f0804
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell getprop ro.build.version.sdk’
[debug] [ADB] Current device property ‘ro.build.version.sdk’: 27
[debug] [ADB] Device API level: 27
[AndroidDriver] Consider setting ‘automationName’ capability to ‘uiautomator2’ o
n Android >= 6, since UIAutomator framework is not maintained anymore by the OS
vendor.
[AndroidDriver] App file was not listed, instead we’re going to run com.miui.cal
culator directly on the device
[debug] [AndroidDriver] Checking whether package is present on the device
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell pm list packages com.miui.calculator’
[AndroidDriver] Starting Android session
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 wait-for-device’
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell echo ping’
[debug] [AndroidDriver] Pushing settings apk to device…
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell pm list packages io.appium.settings’
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for ‘io.appium.settings’
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell dumpsys package io.appium.settings’
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Users\Office\AppData\Local\Android\Sdk\build-tools
28.0.3\aapt.exe
[debug] [ADB] The installed ‘io.appium.settings’ package does not require upgrad
e (‘2.3.0’ >= ‘2.3.0’)
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell ps’
[debug] [ADB] Device API level: 27
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell am start -W -n io.appium.settings/.Setting
s -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x1020000
0’
[debug] [ADB] Device API level: 27
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell appops set io.appium.settings android:moc
k_location allow’
[AndroidDriver] setDeviceLanguageCountry requires language or country.
[AndroidDriver] Got language: ‘null’ and country: ‘null’
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing unlock helper app to device…
[debug] [ADB] Getting install status for io.appium.unlock
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell pm list packages io.appium.unlock’
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for ‘io.appium.unlock’
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell dumpsys package io.appium.unlock’
[debug] [ADB] The installed ‘io.appium.unlock’ package does not require upgrade
(‘2.0.0’ >= ‘2.0.0’)
[ADB] Getting device platform version
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell getprop ro.build.version.release’
[debug] [ADB] Current device property ‘ro.build.version.release’: 8.1.0
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell wm size’
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell getprop ro.product.model’
[debug] [ADB] Current device property ‘ro.product.model’: Redmi Note 5
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell getprop ro.product.manufacturer’
[debug] [ADB] Current device property ‘ro.product.manufacturer’: Xiaomi
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] No app capability. Assuming it is already on the device
[debug] [ADB] Getting install status for com.miui.calculator
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell pm list packages com.miui.calculator’
[debug] [ADB] App is installed
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell am force-stop com.miui.calculator’
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell pm clear com.miui.calculator’
[debug] [AndroidDriver] Performed fast reset on the installed ‘com.miui.calculat
or’ application (stop and clear)
[debug] [AndroidBootstrap] Watching for bootstrap disconnect
[debug] [ADB] Forwarding system: 4724 to device: 4724
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 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 ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 push C:\Users\Office\AppData\Roaming\npm\
node_modules\appium\node_modules\appium-android-driver\bootstrap\bin\Appiu
mBootstrap.jar /data/local/tmp/’
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Running ‘C:\Users\Office\AppData\Local\Android\Sdk\platform-tools
adb.exe -P 5037 -s 35924c6f0804 shell ps’
[ADB] No uiautomator process found to kill, continuing…
[debug] [UiAutomator] Starting UIAutomator
[debug] [ADB] Creating ADB subprocess with args: [”-P”,5037,”-s",“35924c6f0804”,
“shell”,“uiautomator”,“runtest”,“AppiumBootstrap.jar”,"-c",“io.appium.android.bo
otstrap.Bootstrap”,"-e",“pkg”,“com.miui.calculator”,"-e",“disableAndroidWatchers
”,false,"-e",“acceptSslCerts”,false]
[debug] [UiAutomator] Moving to state 'online’
uncaughtException: Android bootstrap socket crashed: Error: getaddrinfo ENOENT u
ndefined:4724
{“date”:“Tue Oct 23 2018 01:42:31 GMT+0530 (India Standard Time)”,“proce
ss”:{“pid”:22440,“uid”:null,“gid”:null,“cwd”:“C:\Users\Office”,“execPath”:“C:
\Program Files\nodejs\node.exe”,“version”:“v8.12.0”,“argv”:[“C:\Program Files
\nodejs\node.exe”,“C:\Users\Office\AppData\Roaming\npm\node_modules\app
ium\build\lib\main.js”],“memoryUsage”:{“rss”:123469824,“heapTotal”:104345600,
“heapUsed”:79044056,“external”:1193085}},“os”:{“loadavg”:[0,0,0],“uptime”:173154
.3100878},“trace”:[{“column”:21,“file”:“C:\Users\Office\AppData\Roaming\npm
\node_modules\appium\node_modules\appium-android-driver\lib\bootstrap.js”,
“function”:null,“line”:97,“method”:null,“native”:false},{“column”:13,“file”:“eve
nts.js”,“function”:“emitOne”,“line”:116,“method”:null,“native”:false},{“column”:
7,“file”:“events.js”,“function”:“Socket.emit”,“line”:211,“method”:“emit”,“native
”:false},{“column”:8,“file”:“internal/streams/destroy.js”,“function”:“emitErrorN
T”,“line”:66,“method”:null,“native”:false},{“column”:11,“file”:“internal/process
/next_tick.js”,“function”:"_combinedTickCallback",“line”:139,“method”:null,“nati
ve”:false},{“column”:9,“file”:“internal/process/next_tick.js”,“function”:“proces
s._tickCallback”,“line”:181,“method”:"_tickCallback",“native”:false}],“stack”:[“
Error: Android bootstrap socket crashed: Error: getaddrinfo ENOENT undefined:472
4”," at Socket. (C:\Users\Office\AppData\Roaming\npm\node_mo
dules\appium\node_modules\appium-android-driver\lib\bootstrap.js:97:21)",“
at emitOne (events.js:116:13)”," at Socket.emit (events.js:211:7)"," at
emitErrorNT (internal/streams/destroy.js:66:8)"," at _combinedTickCallback (
internal/process/next_tick.js:139:11)"," at process._tickCallback (internal/p
rocess/next_tick.js:181:9)"]}
Please help how to resolve this error
Console error:
org.openqa.selenium.WebDriverException: It is impossible to create a new session because ‘createSession’ which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: ‘3.12.0’, revision: ‘7c6e0b3’, time: ‘2018-05-08T14:04:26.12Z’
Code:
package com.example.office.appium_project;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class launchApp {
AndroidDriver<AndroidElement> driver;
@BeforeMethod
public void beforeClass() throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Redmi Note 5");
capabilities.setCapability("udid", "35924c6f0804");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "8.1.0");
// capab.setCapability("appPackage", "io.appium.android.apis");
//capab.setCapability("appActivity", "io.appium.android.apis.ApiDemos");
capabilities.setCapability("appPackage", "com.miui.calculator");
capabilities.setCapability("appActivity", "com.miui.calculator.cal.CalculatorActivity");
driver = new AndroidDriver<AndroidElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
Thread.sleep(5000);
}
@Test
public void m1() throws InterruptedException {
System.out.println("Test");
Thread.sleep(2000);
}
}