question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Espresso server build Issue

See original GitHub issue

Hello, This is my first time that I am trying to use Espresso driver to automate Jetpack compose using an official Jetpack compose sample app ‘Crane’.It is throwing error ‘Unable to create a new Remote session’ due to timeout issue it seems. Please let me know how can I fix this. I have build an APK for the sample app in Android Studio and provided the same in my desired caps.

System Requirements:

  • I am using Appium Desktop version-1.22.0
  • Gradle is installed and added in system variable(C:\Gradle\gradle-7.2\bin) but it still downloads gradle.zip.If I do not mention version in my desired caps,it downloads 6.8.3 version.It is taking a lot of time to clear dist folder and again download all the files.The session timeout happens here.
  • Android SDK Platform tools-33.0.0,32.0.0
  • Java JDK-1.8

Server logs:

[debug] [Espresso] Output from Gradle will be logged. To change this, use 'showGradleLog' desired capability[info] [Gradle] [STDOUT] Downloading https://services.gradle.org/distributions/gradle-7.4.2-all.zip
[info] [Gradle] [STDOUT] ...............10%...............20%...............30%...............40%...............50%................60%...............70%...............80%...............90%...............100%
[info] [HTTP] <-- POST /wd/hub/session - - ms - -
[info] [HTTP] 
[info] [HTTP] Could not cache the response identified by '7cf6c735-cf45-4ff8-b6ec-4fdceca1e0d2', because it has not been completed
[info] [HTTP] Does the client terminate connections too early?

Desired Capabilities that i am using in my test code:

 capabilities.setCapability("showGradleLog",true);
capabilities.setCapability("espressoServerLaunchTimeout","1500000");
capabilities.setCapability("appium:espressoBuildConfig","{\"toolsVersions\":{\"gradle\":\"7.4.2\",\"androidGradlePlugin\":\"7.2.1\",\"buildTools\":\"33.0.0\",\"compileSdk\":\"32\",\"kotlin\":\"1.8.0\",\"composeVersion\":\"1.2.0\",\"annotationVersion\":\"1.2.0\"},"+
     "\"additionalAndroidTestDependencies\":" +
 		    "[\"androidx.lifecycle:lifecycle-extensions:2.2.0\"," +
 		    "\"androidx.activity:activity:1.3.1\", " +
 		    "\"androidx.fragment:fragment:1.2.0\","+
 		    "\"xerces.xercesImpl:2.8.0\","+
 		    "\"xerces.xmlParserAPIs:2.6.2\"]}");
   
     capabilities.setCapability(MobileCapabilityType.APP, "C:\\SampleApps\\app-debug.apk");

     capabilities.setCapability(MobileCapabilityType.FULL_RESET,false);
     capabilities.setCapability("forceEspressoRebuild",true);
    driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

appium-server-logs-terminating early.txt Desired caps_Espresso driver.txt

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jasodharacommented, Aug 2, 2022

The issue is resolved now.Able to build the server and identify compose elements. Have added quite a lot of dependencies in my espressobuildconfig after checking the app’s build.gradle file. Used platform 31 and the android gradleplugin you suggested @KazuCocoa Thanks @KazuCocoa I am still figuring out how to fetch all compose ui elements from a screen and then use it to identify elements.But this issue can be closed. Thanks again @KazuCocoa 😃

0reactions
KazuCocoacommented, Jul 29, 2022

I don’t have any idea right now, but I guess the below NodeJS’s SubProcess command did not pass the command, gradlew.bat -PappiumAndroidGradlePlugin=7.2.1 -PappiumCompileSdk=30 -PappiumMinSdk=27 -PappiumSourceCompatibility=VERSION_1_8 -PappiumTargetCompatibility=VERSION_1_8 -PappiumTargetPackage=ca.gwl.mclaw app:assembleAndroidTest, properly so the gradlew.bat handled some arguments wrongly on Windows environment.

https://github.com/appium/appium-espresso-driver/blob/77c29cd0ee0ddb8e224431a2f2ad9cf214cda20a/lib/server-builder.js#L163-L167

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Unable to build Espresso server - Support
Gradle error message: How to fix this issue now? Espresso driver fails to start activity (android compose app).
Read more >
Espresso setup instructions | Android Developers
Set up your test environment; Add Espresso dependencies ... This guide covers installing Espresso using the SDK Manager and building it using Gradle....
Read more >
appium-espresso-driver - npm Package Health Analysis - Snyk
Gradle must be installed in order to build Espresso server. Both the server package ... See https://github.com/appium/appium/issues/14773 for more details.
Read more >
Automating android native apps using Appium Espresso
Getting Hands Dirty · Capability 'noReset' is optional. · 'showGradleLog' capability will tell us if there is any issue while building the espresso...
Read more >
Appium Scripts are failed to Execute while setting ...
This is off-late as I am starting with Appium with Espresso presently, I was able to solve this issue ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found