javaselenium-webdriverandroid-emulatorappium

Failed to launch the apk file in appium through android emulator


I'm configured the android emulator successfully, and the device is displayed as expected. Also I was successfully startup the appium server, and written the following script through eclipse.

When I execute the code is return the following exception in appium as well as in eclipse o/p console:

Exception:

> Error: ENOENT, no such file or directory 'C:\Users\bharanik\Downloads\adt-bundle-windows-x86-20130219\adt-bundle-windows-x86-20130219\sdk\build-tools'
>     at Object.fs.readdirSync (fs.js:654:18)
>     at exports.getDirectories (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\helpers.js:100:18)
>     at [object Object].ADB.checkSdkBinaryPresent (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:97:25)
>     at [object Object].ADB.checkAdbPresent (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:134:8)
>     at Function.ADB.createADB (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:73:7)
>     at [object Object].androidCommon.initAdb (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:1083:9)
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:610:21
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:249:17
>     at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:149:13)
>     at async.eachSeries (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:165:9)
>     at _asyncMap (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:13)
>     at Object.mapSeries (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:231:23)
>     at Object.async.series (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:608:19)
>     at [object Object].ChromeAndroid.start (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\chrome.js:85:9)
>     at [object Object].Appium.invoke (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:285:17)
>     at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:124:14)
>     at [object Object].ChromeAndroid.configure (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\chrome.js:73:3)
>     at [object Object].Appium.configure (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:250:15)
>     at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:118:10)
>     at [object Object].Appium.start (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:129:5)
>     at exports.createSession (C:\Program Files (x86)\Appium\node_modules\appium\lib\server\controller.js:188:16)
>     at Layer.handle [as handle_request] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session 872882ff-89aa-4adb-9774-6506a3bd9c80
> info: [debug] Checking whether adb is present
> info: <-- POST /wd/hub/session 500 27.062 ms - 204 
> info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4","deviceName":"Android Emulator","platformName":"Android","browserName":"Chrome"}}
> error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress
> info: Client User-Agent string: Apache-HttpClient/4.3.2 (java 1.5)
> info: [debug] Error: Requested a new session but one was in progress
>     at [object Object].Appium.start (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:139:15)
>     at exports.createSession (C:\Program Files (x86)\Appium\node_modules\appium\lib\server\controller.js:188:16)
>     at Layer.handle [as handle_request] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:110:13)
>     at Route.dispatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:91:3)
>     at Layer.handle [as handle_request] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\index.js:267:22
>     at Function.proto.process_params (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:100:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Requested a new session but one was in progress)","origValue":"Requested a new session but one was in progress"},"sessionId":"872882ff-89aa-4adb-9774-6506a3bd9c80"}
> info: <-- POST /wd/hub/session 500 10.559 ms - 250 
> Killed Node Server.
> Node Server Process Ended

Without any fix I tried to execute the same script but this time It returned some different exception as below:

Exception

 error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress
> info: Client User-Agent string: Apache-HttpClient/4.3.2 (java 1.5)
> info: [debug] Error: Requested a new session but one was in progress
>     at [object Object].Appium.start (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:139:15)
>     at exports.createSession (C:\Program Files (x86)\Appium\node_modules\appium\lib\server\controller.js:188:16)
>     at Layer.handle [as handle_request] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:110:13)
>     at Route.dispatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:91:3)
>     at Layer.handle [as handle_request] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\index.js:267:22
>     at Function.proto.process_params (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:100:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
>     at next (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\express\lib\router\route.js:104:14)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Requested a new session but one was in progress)","origValue":"Requested a new session but one was in progress"},"sessionId":"872882ff-89aa-4adb-9774-6506a3bd9c80"}

Can somebody help What is the issue, and root cause? how to resolve this?


Solution

  • Both says the same thing

    error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress
    > info: Client User-Agent string: Apache-HttpClient/4.3.2 (java 1.5)
    > info: [debug] Error: Requested a new session but one was in progress
    

    There is an existing session in the server which is running that emulator of yours .. restart your server and make sure no existing session is running when you request your driver object