Not running test case on android real device

hi everyone,
i got error as session not created and here is the log
desired capabilities i have set are

desiredCapabilities.setCapability("browserName", "Chrome");
    desiredCapabilities.setCapability("platformVersion", "4.3");
    desiredCapabilities.setCapability("platformName", "Android");

here is the log generated on appium server

Checking if an update is available
Update not available
Starting Node Server
info: Welcome to Appium v1.2.3 (REV 90d746b373f55e8653a251d2ce8c62df37941919)
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”:“18”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{“desiredCapabilities”:{“app”:“Chrome”,“deviceName”:“Android Emulator”,“platformName”:“Android”,“versionName”:“4.4”}}e[39m
error: Using local app, but didn’t end in .zip, .ipa or .apk
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. : versionName
error: Failed to start an Appium session, err was: Error: Bad app: C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\Chrome. 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: Using local app, but didn’t end in .zip, .ipa or .apk
info: [debug] No appActivity desired capability or server param. Parsing from apk.
error: Unexpected error: Error: Can’t set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
at ServerResponse.res.set.res.header (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\response.js:561:10)
at ServerResponse.res.send (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\response.js:133:12)
at ServerResponse.res.json (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\response.js:210:15)
at ServerResponse.res.send (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\response.js:121:21)
at C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\server\helpers.js:42:9
at safely (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\server\helpers.js:306:5)
at Layer.module.exports.catchAllHandler [as handle] (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\server\helpers.js:41:3)
at trim_prefix (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:17)
at C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:225:9 context: [POST /wd/hub/session {“desiredCapabilities”:{“app”:“Chrome”,“deviceName”:“Android Emulator”,“platformName”:“Android”,“versionName”:“4.4”}}]
TypeError: Cannot set property ‘onResetTimeout’ of null
at Appium.configure (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\appium.js:275:30)
at Appium.start (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\appium.js:105:10)
at Object.exports.createSession [as handle] (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\server\controller.js:179:16)
info: [debug] No appPackage desired capability or server param. Parsing from apk.
at next_layer (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\route.js:113:13)
at Route.dispatch (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\route.js:117:5)
at C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:222:24
at Function.proto.process_params (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:288:12)
at next (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:216:19)
at next (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\index.js:180:38)
info: [debug] Got configuration error, not starting session
info: [debug] Cleaning up appium session
info: [debug] Error: Bad app: C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\Chrome. 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: Using local app, but didn’t end in .zip, .ipa or .apk
at null. (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\devices\android\android-common.js:55:13)
at Device.configureLocalApp (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\devices\device.js:93:5)
at Device.configureApp (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\devices\device.js:64:10)
at androidCommon.configureApp (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\devices\android\android-common.js:75:35)
at androidCommon.configure (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\devices\android\android-common.js:36:10)
at Appium.configure (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\appium.js:273:15)
at Appium.start (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\appium.js:105:10)
at Object.exports.createSession [as handle] (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\lib\server\controller.js:179:16)
at next_layer (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\route.js:113:13)
at Route.dispatch (C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\node_modules\express\lib\router\route.js:117:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Bad app: C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\Chrome. 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: Using local app, but didn’t end in .zip, .ipa or .apk)”,“origValue”:“Bad app: C:\Users\sinsfm\Desktop\AppiumForWindows-1.2.3.1\Appium\node_modules\appium\Chrome. 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: Using local app, but didn’t end in .zip, .ipa or .apk”},“sessionId”:null}
info: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 11.753 ms - 716e[39m e[90me[39m

@Sarfaraz_Momin
As the error message says, you are giving it a bad app path. The path probably contains spaces. Check and let us know.

@Sarfaraz_Momin
There is some issue with the 1.2.3 version and spaces in path .

hi,
thanks alot,
i found space in the android path
so is there any other way except installing android in other folder like setting in appium

once again thanks

hi,
i have changed the location of my android sdk and path doesnot contain any spaces
but still i m getting error as device not found

and i have run command on my cmd promt and its showing device in list

C:\Users\sinsfm>adb devices
List of devices attached
E8AZCY237063 device

C:\Users\sinsfm>“C:\AndroidSetup\platform-tools\adb.exe” devices
List of devices attached
E8AZCY237063 device

here is the log

info: Welcome to Appium v1.2.3 (REV 90d746b373f55e8653a251d2ce8c62df37941919)
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”:“18”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: [37m–> [39m [37mPOST [39m [37m/wd/hub/session [39m [90m{“desiredCapabilities”:{“platformVersion”:“4.3”,“deviceName”:“Android”,“platformName”:“Android”,“browserName”:“Browser”}} [39m
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session 18df5e2a-933f-4186-9ffd-847b428c9e30
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: [debug] Checking whether adb is present
info: [debug] Using adb from C:\AndroidSetup\platform-tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices
info: [debug] Could not find devices, restarting adb server…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” kill-server
error: Error killing ADB server, going to see if it’s online anyway
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices
info: [debug] Could not find devices, restarting adb server…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” kill-server
error: Error killing ADB server, going to see if it’s online anyway
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices
info: [debug] Could not find devices, restarting adb server…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” kill-server
error: Error killing ADB server, going to see if it’s online anyway
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices
info: [debug] Could not find devices, restarting adb server…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” kill-server
error: Error killing ADB server, going to see if it’s online anyway
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices
info: [debug] Could not find devices, restarting adb server…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” kill-server
error: Error killing ADB server, going to see if it’s online anyway
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices
info: [debug] Could not find devices, restarting adb server…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” kill-server
error: Error killing ADB server, going to see if it’s online anyway
info: [debug] Getting connected devices…
info: [debug] executing: “C:\AndroidSetup\platform-tools\adb.exe” devices

@Sarfaraz_Momin try this code.

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome"); 
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"E8AZCY237063");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"4.4");
	
try 
{
    url = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver(url, capabilities);
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(120, TimeUnit.SECONDS);
 }
catch (MalformedURLException e) 
{
System.out.println("URL init error");
} 

Sorry for the late reply …

Try this capabilities settings in your java code:

capabilities.setCapability(“platformName”,platForm);
capabilities.setCapability(“deviceName”,platForm);
capabilities.setCapability(“appPackage”,appPackageName);
capabilities.setCapability(“appActivity”, appActivityName);
driver = new AppiumDriver(new URL(“http://”+ip+":"+portNumber+"/wd/hub"), capabilities);

Test Automation