Error: Logcat capture failed: spawn ENOENT

Hi All,

I am getting Logcat catpture failed error while running my appium script, there is no space in my sdk folder but still i am getting the same error.

Below is the appium logs, could anyone please help in resolving this issue.

########## Logs #######################################################################
info: [debug] Using adb from C:\Users\Admin\AppData\Local\Android\sdk\platform-
tools\adb.exe

info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root d
irectory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking
along PATH for aapt.
info: [debug] executing cmd: where aapt
info: [debug] Using aapt from C:\Users\Admin\AppData\Local\Android\sdk\build-to
ols\21.1.2\aapt.exe

info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: “C:\Users\Admin\AppData\Local\Android\sdk\build-to
ols\21.1.2\aapt.exe” dump badging C:\APK\Chat_v1.apk
info: [debug] badging package: com.abc.fa.chat
info: [debug] badging act: com.abc.fa.chat.MainActivity
info: [debug] Parsed package and activity are: com.abc.fa.chat/com.abc.fa.chat.MainActivity
info: [debug] Set chromedriver binary as: C:\Program Files (x86)\Appium\node_mod
ules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Users\Admin\AppData\Local\Android\sdk\platform
-tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: “C:\Users\Admin\AppData\Local\Android\sdk\platform
-tools\adb.exe” -s emulator-5554 wait-for-device
info: [debug] executing cmd: “C:\Users\Admin\AppData\Local\Android\sdk\platform
-tools\adb.exe” -s emulator-5554 shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn ENOENT
info: [debug] Stopping logcat capture
####################################################################################

Hi All,

Still i am facing the same issue, Could any one please help in fixing this issue.
I make sure that there is no any path issue in android sdk folder and appium folder, It seems something else.
I suspect it is a small issue but it is blocking me from last couple of days.

Best Regards,
Anil

Hi Anil_Kumar,

Adding system32 location “%SystemRoot%\system32” as PATH variable under System variables will resolve this issue. You are getting this issue because basically appium might need something from system32 directory to interact with adb command during run time.

Hope this resolves your issue.

Regards
@Abdul_Sathar_Beigh

It would also be a good idea to set ANDROID_HOME properly. Here are some ways to do it:

Checking if an update is available
Update available to new version 1.4.16.1
Downloading File from https://bitbucket.org/appium/appium.app/downloads/AppiumForWindows_1_4_16_1.zip
Launching Appium server with command: C:\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --no-reset --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“noReset”:true,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“23”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“app”:“C:\Users\Kathiravan\workspace\APPIUMNEWTESTProject\Apps\Amazon\com.amazon.mShop.android.shopping-5.2.3-502030-minAPI9.apk”,“appPackage”:“in.amazon.mShop.android.shopping”,“appActivity”:“com.amazon.mShop.home.HomeActivity”,“platformVersion”:“5.0.2”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“Moto G”}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_73)
info: [debug] Using local app from desired caps: C:\Users\Kathiravan\workspace\APPIUMNEWTESTProject\Apps\Amazon\com.amazon.mShop.android.shopping-5.2.3-502030-minAPI9.apk
info: [debug] Creating new appium session 001e9bd4-8c22-4547-8324-9aaefb9d6503
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_73
info: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: where adb
info: [debug] Using adb from C:\android_sdk_windows\platform-tools\adb.exe

info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\android_sdk_windows\platform-tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device ZX1D63BN5H
info: [debug] Setting device id to ZX1D63BN5H
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “C:\android_sdk_windows\platform-tools\adb.exe” -s ZX1D63BN5H wait-for-device
info: [debug] executing cmd: “C:\android_sdk_windows\platform-tools\adb.exe” -s ZX1D63BN5H shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn ENOENT
info: [debug] Stopping logcat capture

I am also facing the issues
Removed the spaces
using windows 10

You need to set ANDROID_HOME.

Good info here:

1 Like

Thanks wreed,

I already did it, But nowits showing as below pls help me

Launching Appium server with command: C:\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“23”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“app”:“C:\Users\Kathiravan\workspace\APPIUMNEWTESTProject\Apps\Amazon\com.amazon.mShop.android.shopping-5.2.3-502030-minAPI9.apk”,“appPackage”:“in.amazon.mShop.android.shopping”,“appActivity”:“com.amazon.mShop.home.HomeActivity”,“platformVersion”:“5.0.2”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“Moto G”}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_73)
info: [debug] Using local app from desired caps: C:\Users\Kathiravan\workspace\APPIUMNEWTESTProject\Apps\Amazon\com.amazon.mShop.android.shopping-5.2.3-502030-minAPI9.apk
info: [debug] Creating new appium session 6dec6715-1ddc-4730-8ae5-e43cdf404b0e
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_73
info: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: where adb
info: [debug] Using adb from C:\android_sdk_windows\platform-tools\adb.exe

info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\android_sdk_windows\platform-tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device ZX1D63BN5H
info: [debug] Setting device id to ZX1D63BN5H
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “C:\android_sdk_windows\platform-tools\adb.exe” -s ZX1D63BN5H wait-for-device
info: [debug] executing cmd: “C:\android_sdk_windows\platform-tools\adb.exe” -s ZX1D63BN5H shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn “C:\android_sdk_windows\platform-tools\adb.exe” ENOENT
info: [debug] Stopping logcat capture

Are you using an IDE (like Eclipse) that doesn’t read environment variables? You really should include that in the description of the problem.

1 Like

yes wreed i am using eclipse IDE sorry man

No problem. Eclipse doesn’t always read environment variables. You need to set them in the Eclipse run time settings:

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm

1 Like

Hey man sorry to distur you again still i am having the issue… pls help me

Did you add ANDROID_HOME to the settings of Eclipse? That should take care of it. It’s a pain, I know.

yes wreed but having same issue

Maybe this will help:

I’ve seen a ton of people on these boards have this problem, but once understood it’s generally a straightforward fix.

Hi kathir

Did you Added system32 location “%SystemRoot%\system32” as PATH variable?

Regards
@Abdul_Sathar_Beigh

1 Like

Hi @wreed reed ,

I am also facing the same issue. I am running in eclipse . I have set env variable in eclipse.

Using Windows env
Android Samsung tablet

Apk is already on device

Issue

warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: where adb
info: [debug] Using adb from C:\Users\Jagadeesh\AppData\Local\Android\android-sdk\platform-tools\adb.exe

warn: No app capability, can’t parse package/activity

Below is log info :

info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)

info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“noReset”:true,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“23”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“appPackage”:“in.amazon.mShop.android.shopping”,“appActivity”:“com.amazon.mShop.home.HomeActivity”,“platformVersion”:“4.4.2”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“Samsung”}}
info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_31)
info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session b52708ed-b39c-4849-9001-26d5da47a0be
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_77
info: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: where adb
info: [debug] Using adb from C:\Users\Jagadeesh\AppData\Local\Android\android-sdk\platform-tools\adb.exe

warn: No app capability, can’t parse package/activity
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Users\Jagadeesh\AppData\Local\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device 3100257fd7cf7200
info: [debug] Setting device id to 3100257fd7cf7200
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “C:\Users\Jagadeesh\AppData\Local\Android\android-sdk\platform-tools\adb.exe” -s 3100257fd7cf7200 wait-for-device
info: [debug] executing cmd: “C:\Users\Jagadeesh\AppData\Local\Android\android-sdk\platform-tools\adb.exe” -s 3100257fd7cf7200 shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn “C:\Users\Jagadeesh\AppData\Local\Android\android-sdk\platform-tools\adb.exe” ENOENT
info: [debug] Stopping logcat capture

Program :
package amazon;
import io.appium.java_client.android.AndroidDriver;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Startapplication {

private static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {
	// TODO Auto-generated method stub
	System.out.println("starting");
	DesiredCapabilities capabilities = new DesiredCapabilities();
	 

	capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
	 
	capabilities.setCapability("deviceName", "Samsung");
	 
	capabilities.setCapability("platformVersion", "4.4.2");
	 
	capabilities.setCapability("platformName", "Android");
	 
	//capabilities.setCapability("app", app.getAbsolutePath());
	capabilities.setCapability("appPackage", "in.amazon.mShop.android.shopping");
	 
	capabilities.setCapability("appActivity", "com.amazon.mShop.home.HomeActivity");
	 

	driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	 
	driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
	 
	Thread.sleep(10000);
	//driver.quit();
	
}

}

Can you pls help

If you are getting this error and you believe that you have set ANDROID_HOME, then you have done something incorrectly. Eclipse can be tricky with this.

Here is the Eclipse Discussion Forum where I have searched the term, ‘Environment Variables’. I encourage you to take a look, post a question if you need, and I hope you find the answer for the particular version of Eclipse that you are using, whatever that is:

Hi @wreed,

Am facing a same issue. I have set the Environment variable:

Code:
protected static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {

	//Path to Eclipe Project
	File classpathRoot = new File(System.getProperty("user.dir"));	
	
	//This will get the path to the apps folder that holds the application under test (APK)
	File appDir = new File(classpathRoot, "/apps/");
	
	//This will get the full path to the apk file 
	File app = new File(appDir, "api.apk");
	
	//Create an object for Desired Capabilities
	DesiredCapabilities capabilities = new DesiredCapabilities();
	
	//These are mandatory capabilities that define the device name and platform name. Platform name could be iOS, Android or FirefoxOS
	capabilities.setCapability("deviceName","ZX1C22H769");
	capabilities.setCapability("platformName","Android");
	
	//Some other capabilities that gets the actual app
	capabilities.setCapability("app", app.getAbsolutePath());
	
	//Initialize the driver object with the URL to Appium Server and passing the capabilities 
	driver =  new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	
	//Just added wait so that you can see the actual app loaded in the emulator
	Thread.sleep(5000);
	
	//Quitting the driver session
	driver.quit();
}

Can you help?

Thanks.

Can you post the error?

Hi All

I am also facing the same issue logcat capture failed.

Can any one help here.

Checking if an update is available
Update not available
Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --browser-name Chrome --platform-name Android --platform-version 18 --automation-name Appium --device-name “4d00ac136cac5039” --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“deviceName”:“4d00ac136cac5039”,“platformName”:“Android”,“platformVersion”:“18”,“automationName”:“Appium”,“browserName”:“Chrome”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“capabilities”:{“desiredCapabilities”:{“browserName”:“Chrome”,“platformName”:“Android”,“deviceName”:“4d00ac136cac5039”,“version”:“4.3”},“requiredCapabilities”:null},“desiredCapabilities”:{“browserName”:“Chrome”,“platformName”:“Android”,“deviceName”:“4d00ac136cac5039”,“version”:“4.3”},“requiredCapabilities”:null}
info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_101)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session 4a8c9ad4-4694-4ded-b49c-943d33925a75
info: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: where adb
info: [debug] Using adb from D:\sdk\platform-tools\adb.exe

info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “D:\sdk\platform-tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device 4d00ac136cac5039
info: [debug] Setting device id to 4d00ac136cac5039
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “D:\sdk\platform-tools\adb.exe” -s 4d00ac136cac5039 wait-for-device
info: [debug] executing cmd: “D:\sdk\platform-tools\adb.exe” -s 4d00ac136cac5039 shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn “D:\sdk\platform-tools\adb.exe” ENOENT
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: spawn “D:\sdk\platform-tools\adb.exe” ENOENT
info: [debug] Error: spawn “D:\sdk\platform-tools\adb.exe” ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1054:32)
at child_process.js:1145:20
at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: spawn "D:\sdk\platform-tools\adb.exe" ENOENT)”,“code”:“ENOENT”,“errno”:“ENOENT”,“syscall”:“spawn "D:\sdk\platform-tools\adb.exe"”,“path”:“"D:\sdk\platform-tools\adb.exe"”,“origValue”:“spawn "D:\sdk\platform-tools\adb.exe" ENOENT”},“sessionId”:null}
info: ← POST /wd/hub/session 500 3430.161 ms - 354