Skip to content

Failed resolution of: Ljava/net/http/HttpClient; #2117

Open

Description

@LivPNavusoft

Description

Attempting to setup Appium in a KMM app, currently working on the Android side. Attempting to run a basic test results in the runtime error in the title when the AndroidDriver() is instantiated.

Environment

  • Kotlin 1.9.10
  • Java client 9.1.0
  • Selenium 4.17.0
  • Appium CLI v2.4.1
  • MacOS Ventura 13.5.2
  • Android API 34
  • Pixel 7 Emulator

Details

Please provide more details, if necessary.

Attempting to run the test always fails at driver = AndroidDriver(url, options) and results in the stack trace below. The missing library, java.net.http.HttpClient, doesn't appear to be available on Android.

Failed resolution of: Ljava/net/http/HttpClient;
at org.openqa.selenium.remote.http.jdk.JdkHttpClient.<init>(JdkHttpClient.java:90)
at org.openqa.selenium.remote.http.jdk.JdkHttpClient$Factory.createClient(JdkHttpClient.java:475)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:114)
at io.appium.java_client.remote.AppiumCommandExecutor.<init>(AppiumCommandExecutor.java:75)
at io.appium.java_client.remote.AppiumCommandExecutor.<init>(AppiumCommandExecutor.java:102)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:102)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:109)
at com.navusoft.navusaleskmp.test.utils.AuthTest.setUp(AppiumSetup.kt:31)

Code To Reproduce Issue

https://gist.github.com/LivPNavusoft/a190821ffeab12430f651a02727e9b0a

Exception Stacktraces

https://gist.github.com/LivPNavusoft/3ea2a999730d7c2ef6c7d6772ead3131

Link To Appium Logs

None generated, it never connects. Verified I can start a session with AppiumInspector

Activity

  1. mykola-mokhnach commented on Feb 14, 2024

    @mykola-mokhnach
    Contributor

    This is probably something related to Kotlin and has nothing to do with this lib. Try ktorio/ktor#1608

  2. LivPNavusoft commented on Feb 14, 2024

    @LivPNavusoft
    Author

    @mykola-mokhnach Hello! We do not make use of Ljava/net/http/HttpClient; anywhere in this project. The test code in the gist is the only code being ran, and is just boilerplate based on Appium Inspector's code for establishing a session connection. It appears to be called from AndroidDriver's instantiation

  3. mykola-mokhnach commented on Feb 14, 2024

    @mykola-mokhnach
    Contributor

    It does not really matter. java/net/http/HttpClient is the standard Java HTTP client implementation since JDK9 and is used by selenium to communicate with the remote server. Absence of it would make such communication impossible. A workaround would be to avoid the use of this lib and to build a custom client based on a different downstream implementation.

  4. LivPNavusoft commented on Feb 14, 2024

    @LivPNavusoft
    Author

    I may misunderstand, java/net/http/HttpClient is certainly the standard, but as far as I'm aware it has never been available in Android. How is the AndroidDriver typically set up to work around this?

  5. mykola-mokhnach commented on Feb 14, 2024

    @mykola-mokhnach
    Contributor

    I don't have an answer there. The client is designed to work on Linux/macOS or Windows host running OpenJDK 11+ runtime. We have never tested the compatibility to other environments (Selenium did not as well)

  6. StanislawRichardt commented on Nov 4, 2024

    @StanislawRichardt

    Hi! I also have exact same issue. Did you had any luck finding the answer by yourself?

  7. LivPNavusoft commented on Nov 5, 2024

    @LivPNavusoft
    Author

    No, apologies as I was unaware this was still open. We decided to go with other frameworks/solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions