I Cannot build Espresso server

Hello guys,

I wanted to try Espresso driver instead of UiAutomator2, but I am not able to build the Espresso server. I am using Python 3.12 with Appium-Python-Client 4.1, Appium 3.7.11 and the error I get is associated with moving workspace to immutable location during the build.

I tried appium driver doctor espresso and based on it I have everything necessary for using Espresso.

I use Gradle 8.7 and Espresso 3.5.0

Thanks for any suggestion :slight_smile:

Full error message:

E       selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. Details: Unable to build Espresso server - Process ended with exitcode 1 (cmd: 'gradlew.bat -PappiumTargetPackage\=com.sensus.datalogger app\:assembleAndroidTest')
E       Gradle error message:
E       
E       FAILURE: Build failed with an exception.
E       
E       * What went wrong:
E       A problem occurred configuring root project 'espresso-server-HA11RZB8'.
E       > A build operation failed.
E             Could not move temporary workspace (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95-cdcfad27-e7d9-4c73-a0d9-0fd33979bc65) to immutable location (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95)
E          > Could not move temporary workspace (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95-cdcfad27-e7d9-4c73-a0d9-0fd33979bc65) to immutable location (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95)
E       
E       * Try:
E       > Run with --stacktrace option to get the stack trace.
E       > Run with --info or --debug option to get more log output.
E       > Run with --scan to get full insights.
E       > Get more help at https://help.gradle.org.
E       
E       BUILD FAILED in 33s. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
E       Stacktrace:
E       Error: Unable to build Espresso server - Process ended with exitcode 1 (cmd: 'gradlew.bat -PappiumTargetPackage\=com.sensus.datalogger app\:assembleAndroidTest')
E       Gradle error message:
E       
E       FAILURE: Build failed with an exception.
E       
E       * What went wrong:
E       A problem occurred configuring root project 'espresso-server-HA11RZB8'.
E       > A build operation failed.
E             Could not move temporary workspace (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95-cdcfad27-e7d9-4c73-a0d9-0fd33979bc65) to immutable location (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95)
E          > Could not move temporary workspace (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95-cdcfad27-e7d9-4c73-a0d9-0fd33979bc65) to immutable location (C:\Users\KarelVrabka\.gradle\caches\transforms-4\0e3d066c04823d848bd7baad72661c95)
E       
E       * Try:
E       > Run with --stacktrace option to get the stack trace.
E       > Run with --info or --debug option to get more log output.
E       > Run with --scan to get full insights.
E       > Get more help at https://help.gradle.org.
E       
E       BUILD FAILED in 33s. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
E           at Object.errorWithException (C:\Users\KarelVrabka\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\support\lib\logging.js:41:45)
E           at Object.errorAndThrow (C:\Users\KarelVrabka\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\support\lib\logging.js:44:18)
E           at ServerBuilder.runBuildProcess (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\server-builder.js:194:16)
E           at ServerBuilder.build (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\server-builder.js:72:5)
E           at EspressoRunner.buildNewModServer (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\espresso-runner.js:216:5)
E           at EspressoRunner.installTestApk (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\espresso-runner.js:174:7)
E           at EspressoDriver.initAUT (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\driver.ts:588:7)
E           at EspressoDriver.startEspressoSession (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\driver.ts:435:5)
E           at EspressoDriver.createSession (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\driver.ts:270:7)
E           at AppiumDriver.createSession (C:\Users\KarelVrabka\AppData\Roaming\npm\node_modules\appium\lib\appium.js:731:35)

Looks like it’s a Gradle bug:

If you read through the bug you’ll see your error related to Node.js. Fix is supposed to be in Gradle 8.11.

Thank you for the info. I tried to switch to different versions of Gradle, but no I got different error. Is it because the app I want to test uses Gradle 8.7?

* What went wrong:
E       Could not read workspace metadata from C:\Users\KarelVrabka\.gradle\caches\8.7\kotlin-dsl\scripts\e0e11b76cd2cf204ca81fcbbdb2ffdd6\metadata.bin
E       > C:\Users\KarelVrabka\.gradle\caches\8.7\kotlin-dsl\scripts\e0e11b76cd2cf204ca81fcbbdb2ffdd6\metadata.bin (The system cannot find the path specified)
E       
E       * Try:
E       > Run with --stacktrace option to get the stack trace.
E       > Run with --info or --debug option to get more log output.
E       > Run with --scan to get full insights.
E       > Get more help at https://help.gradle.org.
E       
E       BUILD FAILED in 6s. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
E           at Object.errorWithException (C:\Users\KarelVrabka\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\support\lib\logging.js:41:45)
E           at Object.errorAndThrow (C:\Users\KarelVrabka\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\support\lib\logging.js:44:18)
E           at ServerBuilder.runBuildProcess (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\server-builder.js:194:16)
E           at ServerBuilder.build (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\server-builder.js:72:5)
E           at EspressoRunner.buildNewModServer (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\espresso-runner.js:216:5)
E           at EspressoRunner.installTestApk (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\espresso-runner.js:174:7)
E           at EspressoDriver.initAUT (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\driver.ts:588:7)
E           at EspressoDriver.startEspressoSession (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\driver.ts:435:5)
E           at EspressoDriver.createSession (C:\Users\KarelVrabka\.appium\node_modules\appium-espresso-driver\lib\driver.ts:270:7)
E           at AppiumDriver.createSession (C:\Users\KarelVrabka\AppData\Roaming\npm\node_modules\appium\lib\appium.js:731:35)

.venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:229: SessionNotCreatedException

If I had to guess, that file doesn’t exist on the system. There isn’t any way for me to check though.

Best advice is to read through that bug. There are several suggestions on ways around it. Of course, if you’d like to get a more expert opinion than mine, there is always the gradle forum:

I changed the Gradle version in graddle-wrapper.properties to 8.10.2 and it can be built successfully now.

1 Like