java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;Lorg/apache/http/entity/ContentType;)V in class Lorg/apache/http/entity/StringEntity; or its super classes (declaration of 'org.apache.http.entity.StringEntity' appears in /system/framework/org.apache.http.legacy.boot.jar)

GitHub | handstandsam | 9 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 1

    GitHub comment 455#231082542

    GitHub | 9 months ago | handstandsam
    java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/String;Lorg/apache/http/entity/ContentType;)V in class Lorg/apache/http/entity/StringEntity; or its super classes (declaration of 'org.apache.http.entity.StringEntity' appears in /system/framework/org.apache.http.legacy.boot.jar)

    Root Cause Analysis

    1. java.lang.NoSuchMethodError

      No direct method <init>(Ljava/lang/String;Lorg/apache/http/entity/ContentType;)V in class Lorg/apache/http/entity/StringEntity; or its super classes (declaration of 'org.apache.http.entity.StringEntity' appears in /system/framework/org.apache.http.legacy.boot.jar)

      at com.github.tomakehurst.wiremock.client.HttpAdminClient.postJsonAssertOkAndReturnBody()
    2. WireMock
      WireMock.stubFor
      1. com.github.tomakehurst.wiremock.client.HttpAdminClient.postJsonAssertOkAndReturnBody(HttpAdminClient.java:235)
      2. com.github.tomakehurst.wiremock.client.HttpAdminClient.addStubMapping(HttpAdminClient.java:104)
      3. com.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:229)
      4. com.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:225)
      5. com.github.tomakehurst.wiremock.client.WireMock.givenThat(WireMock.java:100)
      6. com.github.tomakehurst.wiremock.client.WireMock.stubFor(WireMock.java:104)
      6 frames
    3. com.handstandsam.httpmocking
      WireMockActivityInstrumentationTestCase2.testWiremock
      1. com.handstandsam.httpmocking.tests.wiremock.WireMockActivityInstrumentationTestCase2.testWiremock(WireMockActivityInstrumentationTestCase2.java:70)
      1 frame
    4. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    5. JUnit
      RunBefores.evaluate
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      5 frames
    6. WireMock
      WireMockRule$1.evaluate
      1. com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:72)
      1 frame
    7. JUnit
      JUnitCore.run
      1. org.junit.rules.RunRules.evaluate(RunRules.java:20)
      2. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      3. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      4. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      5. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      6. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      7. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      8. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      9. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      10. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      11. org.junit.runners.Suite.runChild(Suite.java:128)
      12. org.junit.runners.Suite.runChild(Suite.java:27)
      13. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      14. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      15. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      16. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      17. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      18. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      19. org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      20. org.junit.runner.JUnitCore.run(JUnitCore.java:115)
      20 frames
    8. android.support.test
      AndroidJUnitRunner.onStart
      1. android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:54)
      2. android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:240)
      2 frames
    9. Android Platform
      Instrumentation$InstrumentationThread.run
      1. android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)
      1 frame