How to use apache http on Android P











up vote
4
down vote

favorite
1












When I run my app in Android P devices, I get some error like this:



java.lang.RuntimeException: Unable to instantiate application com.le.android.client.LeApplication: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1009)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5836)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6649)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
at android.app.Instrumentation.newApplication(Instrumentation.java:1120)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1001)
... 9 more


How should I use the library org.apache.http.legacy in Android P?










share|improve this question




























    up vote
    4
    down vote

    favorite
    1












    When I run my app in Android P devices, I get some error like this:



    java.lang.RuntimeException: Unable to instantiate application com.le.android.client.LeApplication: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
    at android.app.LoadedApk.makeApplication(LoadedApk.java:1009)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5836)
    at android.app.ActivityThread.access$1000(ActivityThread.java:198)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6649)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
    at android.app.Instrumentation.newApplication(Instrumentation.java:1120)
    at android.app.LoadedApk.makeApplication(LoadedApk.java:1001)
    ... 9 more


    How should I use the library org.apache.http.legacy in Android P?










    share|improve this question


























      up vote
      4
      down vote

      favorite
      1









      up vote
      4
      down vote

      favorite
      1






      1





      When I run my app in Android P devices, I get some error like this:



      java.lang.RuntimeException: Unable to instantiate application com.le.android.client.LeApplication: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
      at android.app.LoadedApk.makeApplication(LoadedApk.java:1009)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5836)
      at android.app.ActivityThread.access$1000(ActivityThread.java:198)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6649)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

      Caused by: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
      at android.app.Instrumentation.newApplication(Instrumentation.java:1120)
      at android.app.LoadedApk.makeApplication(LoadedApk.java:1001)
      ... 9 more


      How should I use the library org.apache.http.legacy in Android P?










      share|improve this question















      When I run my app in Android P devices, I get some error like this:



      java.lang.RuntimeException: Unable to instantiate application com.le.android.client.LeApplication: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
      at android.app.LoadedApk.makeApplication(LoadedApk.java:1009)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5836)
      at android.app.ActivityThread.access$1000(ActivityThread.java:198)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6649)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

      Caused by: java.lang.ClassNotFoundException: Didn't find class "com.le.android.client.LeApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/lib/arm, /data/app/com.le.android.client-uvQkO641-__8Z_p2oT0t7g==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
      at android.app.Instrumentation.newApplication(Instrumentation.java:1120)
      at android.app.LoadedApk.makeApplication(LoadedApk.java:1001)
      ... 9 more


      How should I use the library org.apache.http.legacy in Android P?







      java android apache-httpcomponents






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 21 at 10:24









      Jörg Beyer

      2,7691330




      2,7691330










      asked May 21 at 9:50









      Scott

      797




      797
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote













          I read the Android P behavior changes,and I get some messages:




          Apache HTTP client deprecation
          With Android 6.0, we removed support for the Apache HTTP client.
          Beginning with Android P, that library is removed from the
          bootclasspath and is not available to apps by default.



          To continue using the Apache HTTP client,
          apps that target Android P and above must add the following to their AndroidManifest.xml:



          <uses-library android:name="org.apache.http.legacy" android:required="false"/>



          Note: The android:required="false" attribute is required for apps that mave a minimum SDK of 23 or lower, because on devices with API levels lower than 24, the org.apache.http.legacy library is not available. (On those devices, the Apache HTTP classes are available on the bootclasspath.)







          share|improve this answer



















          • 1




            Even after adding this...my app still crash with the same error @scott
            – divaPrajapati09
            Nov 13 at 13:28











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50446148%2fhow-to-use-apache-http-on-android-p%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote













          I read the Android P behavior changes,and I get some messages:




          Apache HTTP client deprecation
          With Android 6.0, we removed support for the Apache HTTP client.
          Beginning with Android P, that library is removed from the
          bootclasspath and is not available to apps by default.



          To continue using the Apache HTTP client,
          apps that target Android P and above must add the following to their AndroidManifest.xml:



          <uses-library android:name="org.apache.http.legacy" android:required="false"/>



          Note: The android:required="false" attribute is required for apps that mave a minimum SDK of 23 or lower, because on devices with API levels lower than 24, the org.apache.http.legacy library is not available. (On those devices, the Apache HTTP classes are available on the bootclasspath.)







          share|improve this answer



















          • 1




            Even after adding this...my app still crash with the same error @scott
            – divaPrajapati09
            Nov 13 at 13:28















          up vote
          6
          down vote













          I read the Android P behavior changes,and I get some messages:




          Apache HTTP client deprecation
          With Android 6.0, we removed support for the Apache HTTP client.
          Beginning with Android P, that library is removed from the
          bootclasspath and is not available to apps by default.



          To continue using the Apache HTTP client,
          apps that target Android P and above must add the following to their AndroidManifest.xml:



          <uses-library android:name="org.apache.http.legacy" android:required="false"/>



          Note: The android:required="false" attribute is required for apps that mave a minimum SDK of 23 or lower, because on devices with API levels lower than 24, the org.apache.http.legacy library is not available. (On those devices, the Apache HTTP classes are available on the bootclasspath.)







          share|improve this answer



















          • 1




            Even after adding this...my app still crash with the same error @scott
            – divaPrajapati09
            Nov 13 at 13:28













          up vote
          6
          down vote










          up vote
          6
          down vote









          I read the Android P behavior changes,and I get some messages:




          Apache HTTP client deprecation
          With Android 6.0, we removed support for the Apache HTTP client.
          Beginning with Android P, that library is removed from the
          bootclasspath and is not available to apps by default.



          To continue using the Apache HTTP client,
          apps that target Android P and above must add the following to their AndroidManifest.xml:



          <uses-library android:name="org.apache.http.legacy" android:required="false"/>



          Note: The android:required="false" attribute is required for apps that mave a minimum SDK of 23 or lower, because on devices with API levels lower than 24, the org.apache.http.legacy library is not available. (On those devices, the Apache HTTP classes are available on the bootclasspath.)







          share|improve this answer














          I read the Android P behavior changes,and I get some messages:




          Apache HTTP client deprecation
          With Android 6.0, we removed support for the Apache HTTP client.
          Beginning with Android P, that library is removed from the
          bootclasspath and is not available to apps by default.



          To continue using the Apache HTTP client,
          apps that target Android P and above must add the following to their AndroidManifest.xml:



          <uses-library android:name="org.apache.http.legacy" android:required="false"/>



          Note: The android:required="false" attribute is required for apps that mave a minimum SDK of 23 or lower, because on devices with API levels lower than 24, the org.apache.http.legacy library is not available. (On those devices, the Apache HTTP classes are available on the bootclasspath.)








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 5 at 5:08









          Maitreya

          626813




          626813










          answered May 22 at 2:22









          Scott

          797




          797








          • 1




            Even after adding this...my app still crash with the same error @scott
            – divaPrajapati09
            Nov 13 at 13:28














          • 1




            Even after adding this...my app still crash with the same error @scott
            – divaPrajapati09
            Nov 13 at 13:28








          1




          1




          Even after adding this...my app still crash with the same error @scott
          – divaPrajapati09
          Nov 13 at 13:28




          Even after adding this...my app still crash with the same error @scott
          – divaPrajapati09
          Nov 13 at 13:28


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50446148%2fhow-to-use-apache-http-on-android-p%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen