How to use the legacy Apache HTTP client on Android Marshmallow? –

Development issue/problem:

On Android Marshmallow, Google has completely removed support for the Apache HTTP client (link here) because it is not very efficient compared to other solutions.

This could also be the cause of the crash of many applications on Android Marshmallow.

Google allows you to use this API anyway, but not as a built-in API, by adding this line to the :

useLibrary ‘org.apache.http.legacy’.

So I did:

Dependencies {
classpath ‘com.android.tools.build:gradle:1.3.0’
}

И.. :

android {
compileSdkVersion ‘android-MNC’
buildToolsVersion 23.0.0 rc3
useLibrary ‘org.apache.http.legacy

defaultConfig {
applicationId com.example.user.androidmtest
minSdkVersion ‘MNC’
targetSdkVersion ‘MNC’
versionCode 1
versionName 1.0
}

When I tried it, it was well compiled (no errors appeared and I was able to run the proof-of-concept application because it didn’t contain any special code), but when I tried to use some of the classes that I know are part of the old API (such as the HttpClient class), I saw that it didn’t allow me to do so.

I know it is not advisable to use this solution, but we should have an application that works at least temporarily until we have worked on 100% of everything that needs to change for Android Marshmallow, and we don’t want any surprises in the form of crashes.

Here’s a screenshot:

Why is that? Did I use it well?

I reported it here:

https://code.google.com/p/android/issues/detail?id=181474

How can I solve this problem?

Solution 1:

Android Studio found flaws in the org.apache.http classes such as

org.apache.http.nameValuePair
org.apache.http.client.utils.URLEncodedUtils

have disappeared.

So I added org.apache.http.legacy.jar, which is in the
Android/Sdk/platforms/android-23/optional folder, to the app/libs folder.

I also added this line to my app.gradle file.

Compiling the files (libs/org.apache.http.legacy.jar)

However, if you use multiple libraries, you can use this method.

compile fileTree(dir: ‘libs’, include: [‘*.jar’]).

This fixes all my bugs caused by the removal of support for the Apache HTTP client by Google.

Solution 2:

The useLibrary ‘org.apache.http.legacy’ didn’t work for me until I updated the version of the Gradle tools in my main build.gradle file of the Android Studio project, as you can see below:

Dependencies {
classpath ‘com.android.tools.build:gradle:1.3.0’
}

Solution 3:

The ideal solution is to check the path to the file.
with commissioning

android {
compileSdkVersion ‘android-MNC’
buildToolsVersion 23.0.0 rc3
useLibrary ‘org.apache.http.legacy

defaultConfig {
applicationId com.example.user.androidmtest
minSdkVersion ‘MNC’
targetSdkVersion ‘MNC’
versionCode 1
versionName 1.0

}

getBootClasspath().each{File ->
println file.absolutePath
}
}
}

You’ll get something similar

/Users/journame/development/android-sdk-macosx/platforms/android-MNC/android.jar
/Users/journame/development/android-sdk-macosx/platforms/android-MNC/optional/g.apache.http.legacy.jar

So, the glass is here. For some reason it hasn’t been added to the project, but you can always add it manually, I think.

Solution 4:

After many frustrating hours, the following worked:

1. Find a can of Apache.
He has to live somewhere:

C: UserAppDataLocalAndroidsdk platformsandroid-23optional

2. Copy org.apache.http.legacy.jar to the libs folder.

You can right-click on Libs -> Paste, or use your file explorer to navigate to and paste the Libs folder of your project.

If you don’t have a libsmap like me, create a new project and import all relevant files in the right places.

3. Press OK
and watch this

4. The most important step: Right-click on the apache folder and select Add as Library.
see the following

I hope it helps someone get on with their life.

Solution No 5:

The answer above allows you to easily debug and publish builds with Gradle.

Add it to the application tag in the manifest file, on all instances of the project that use legacy Apache classes :

This helps those who still work with Eclipse and Anti-scripts to compose the scripts.

Solution No 6:

I know it’s a stupid reason, but on the list, try …….

I’ve encountered this problem recently and it is caused by a limitation of the path length, I think the maximum is 256 characters.

Rewrite your project and the building will be built successfully, hoping that this work will be done for you.

Solution No 7:

The old Apache library, which is located at

[ANDROID_SDK] platformdroid-23optionalorg.apache.http.legacy.jar

So you can copy it to your project libraries or just use it with

Compile Files (${android.getSdkDirectory().getAbsolutePath()}. + file.separator + platform + file.separator + android-23 + file.separator + optional + file.separator + org.apache.http.legacy.jar)

in your /app/build.gradle

Solution No 8:

First of all, you need to check your libs file to make sure that

Then paste them into your thesis file as follows.

android {
compileSdkVersion 23
buildToolsVersion ‘23.0.2

defaultConfig {
applicationId info.tranetech.laundry
minSdkVersion 15
targetSdkVersion 23
versionCode
versionName 1.0
} Build types
{ release
{ release
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
}
}
} android {
useLibrary ‘org.apache.http.legacy’
} Dependencies
[
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
compile ‘com.android.support:appcompat-v7:23.0.1 1
compile ‘com.android.support:design:23.0.
testCompile ‘junit:junit:4.12’
compiles files (‘libs/android-async-http-1.4.4.jar’)
compiles ‘com.google.android.gms:play-services:8.4.0’
}

Solution No 9:

Add this to sdk/platform/android-23/optional/optional.json

{
name: org.apache.http.legacy.jar,
pot: org.apache.http.legacy.jar,
manifest: fake
}
]

Solution No 10:

Delete

useLibrary ‘org.apache.http.legacy’.

from build.gradle, and I also added this line to my app.gradle file.

Compiling the files (libs/org.apache.http.legacy.jar)

However, if you use multiple libraries, you can use this method.

compile fileTree(dir: ‘libs’, include: [‘*.jar’]).

The CoPLaS response has solved my problems.

Good luck!

Related Tags:

best video converter for android,divx converter,wondershare free video converter,videoproc crack,free vob to mp4 converter windows 10,winx hd video converter deluxe,What is the best video converter?We've provided a list of our top video converters above with VideoProc and Wondershare UniConverter leading the pack. However, the one you choose will depend on your specific needs. Of course, everyone wants good value for money, but other key criteria to look out for include:,Format options: A large range of format options is a plus, but you'll want to make sure the converter you choose supports the formats you work with most often.Features: Is there a must-have feature on your list such as options to include chapters or subtitles? It's worth checking the provider's website for information on any desired functionality before you make your purchase. If you can't find what you're looking for, you may want to ask the support team as some providers fail to highlight every feature on their site.Usability: There's no point in having a full-featured video converter is it's too complicated to use. We recommend taking full advantage of free trial periods and online guides to ensure you…  MoreCan I use a video converter to convert to MP3?Yes, you can. In fact, all of the converters on our list can convert to MP3 audio files, including VideoProc, Wondershare UniConverter, DivX Converter, and others.,MP3 files might be desirable for multiple reasons including their small size and compatibility with a host of players. To convert to MP3, simply select this file type as your output format and tweak settings as needed. Using this method, you can extract an MP3 audio file from almost any video file or other audio format.Which is the best free video converter?Much like any free tool, a free video converter might disappoint. We've featured a few free tools on our list including free versions of DivX, Freemake, Any Video Converter, and NCH Prism, and the completely free HandBrake software. These may be suitable for some users, but they usually come with some downsides, including:,Watermarks: It's common for free video converters to emblazon your video with a watermark. This works to the provider's benefit in two ways. It acts as an incentive for the user to pay for a premium version of the software to remove the watermark. It also acts as an advertisement for the converter if free videos are shared.Length limit: Another common way for video converter providers to put users off the free version of their freemium software is to limit the time length of videos.Lack of features: A small handful of free video converters offer a robust selection of features while others fall short in areas like editing suite selection and format options.Upsells:  More,We've provided a list of our top video converters above with VideoProc and Wondershare UniConverter leading the pack. However, the one you choose will depend on your specific needs. Of course, everyone wants good value for money, but other key criteria to look out for include:,Format options: A large range of format options is a plus, but you'll want to make sure the converter you choose supports the formats you work with most often.Features: Is there a must-have feature on your list such as options to include chapters or subtitles? It's worth checking the provider's website for information on any desired functionality before you make your purchase. If you can't find what you're looking for, you may want to ask the support team as some providers fail to highlight every feature on their site.Usability: There's no point in having a full-featured video converter is it's too complicated to use. We recommend taking full advantage of free trial periods and online guides to ensure you…  More,Yes, you can. In fact, all of the converters on our list can convert to MP3 audio files, including VideoProc, Wondershare UniConverter, DivX Converter, and others.,MP3 files might be desirable for multiple reasons including their small size and compatibility with a host of players. To convert to MP3, simply select this file type as your output format and tweak settings as needed. Using this method, you can extract an MP3 audio file from almost any video file or other audio format.,Much like any free tool, a free video converter might disappoint. We've featured a few free tools on our list including free versions of DivX, Freemake, Any Video Converter, and NCH Prism, and the completely free HandBrake software. These may be suitable for some users, but they usually come with some downsides, including:,any video converter free,any video converter review,What is a codec?This is the principle of video file encoding. In most cases, it is directly tied to quality and size of the file. For example, an MP3 audio file will have smaller size, but with much worse sound quality than audio in WAV.What's the difference between file format and codec?The format determines file content for the players (number of audio tracks, subtitles, meta data and other). And the codec determines the principle by which this content can be played.Is the use of video converters legal?Yes, if you use it only for personal purposes. If you are converting a video that may be protected by copyright, we recommend you ask the copyright owner for a permission. Another little note – converting a movie from an officially purchased disc to any other format is illegal in the United States and Europe.Is converting sound clips from YouTube legal?Downloading and converting any copyrighted video from YouTube is illegal. Also, downloading any YouTube video will be interpreted as a violation of YouTube's Terms of Use. This is not a criminal offense, but may lead to the suspension of your account.Which video converter can be used on Windows 10?All video converters in this review are compatible with Windows 10, including Any Video Converter and Wondershare Video Converter.Can I convert a video file to an audio file?Yes, but the file will not contain video and subtitles.Are there any video converters for Android?Yes, here are some of them: Video Format Factory, VidCompact, Vidsoftlab Video Converter.Which video converter is the fastest?The conversion speed depends on the characteristics of the equipment.How to reduce file size using video converter?For audio files, the easiest way is to convert to MP3, for video files, reduce the resolution of the video (and in some cases) use a codec with better video compression (for example MPEG).Is Any Video Converter safe?Yes, Any Video Converter has successfully passed the safety test.View more on thinkmobiles.comShow moreShow less,What is a codec?This is the principle of video file encoding. In most cases, it is directly tied to quality and size of the file. For example, an MP3 audio file will have smaller size, but with much worse sound quality than audio in WAV.What's the difference between file format and codec?The format determines file content for the players (number of audio tracks, subtitles, meta data and other). And the codec determines the principle by which this content can be played.Is the use of video converters legal?Yes, if you use it only for personal purposes. If you are converting a video that may be protected by copyright, we recommend you ask the copyright owner for a permission. Another little note – converting a movie from an officially purchased disc to any other format is illegal in the United States and Europe.Is converting sound clips from YouTube legal?Downloading and converting any copyrighted video from YouTube is illegal. Also, downloading any YouTube video will be interpreted as a violation of YouTube's Terms of Use. This is not a criminal offense, but may lead to the suspension of your account.Which video converter can be used on Windows 10?All video converters in this review are compatible with Windows 10, including Any Video Converter and Wondershare Video Converter.Can I convert a video file to an audio file?Yes, but the file will not contain video and subtitles.Are there any video converters for Android?Yes, here are some of them: Video Format Factory, VidCompact, Vidsoftlab Video Converter.Which video converter is the fastest?The conversion speed depends on the characteristics of the equipment.How to reduce file size using video converter?For audio files, the easiest way is to convert to MP3, for video files, reduce the resolution of the video (and in some cases) use a codec with better video compression (for example MPEG).Is Any Video Converter safe?Yes, Any Video Converter has successfully passed the safety test.View more on thinkmobiles.com,This is the principle of video file encoding. In most cases, it is directly tied to quality and size of the file. For example, an MP3 audio file will have smaller size, but with much worse sound quality than audio in WAV.,The format determines file content for the players (number of audio tracks, subtitles, meta data and other). And the codec determines the principle by which this content can be played.,Yes, if you use it only for personal purposes. If you are converting a video that may be protected by copyright, we recommend you ask the copyright owner for a permission. Another little note – converting a movie from an officially purchased disc to any other format is illegal in the United States and Europe.,Is converting sound clips from YouTube legal?Downloading and converting any copyrighted video from YouTube is illegal. Also, downloading any YouTube video will be interpreted as a violation of YouTube's Terms of Use. This is not a criminal offense, but may lead to the suspension of your account.Which video converter can be used on Windows 10?All video converters in this review are compatible with Windows 10, including Any Video Converter and Wondershare Video Converter.Can I convert a video file to an audio file?Yes, but the file will not contain video and subtitles.Are there any video converters for Android?Yes, here are some of them: Video Format Factory, VidCompact, Vidsoftlab Video Converter.Which video converter is the fastest?The conversion speed depends on the characteristics of the equipment.How to reduce file size using video converter?For audio files, the easiest way is to convert to MP3, for video files, reduce the resolution of the video (and in some cases) use a codec with better video compression (for example MPEG).Is Any Video Converter safe?Yes, Any Video Converter has successfully passed the safety test.View more on thinkmobiles.com,Downloading and converting any copyrighted video from YouTube is illegal. Also, downloading any YouTube video will be interpreted as a violation of YouTube's Terms of Use. This is not a criminal offense, but may lead to the suspension of your account.,All video converters in this review are compatible with Windows 10, including Any Video Converter and Wondershare Video Converter.,Yes, but the file will not contain video and subtitles.,Yes, here are some of them: Video Format Factory, VidCompact, Vidsoftlab Video Converter.,The conversion speed depends on the characteristics of the equipment.,For audio files, the easiest way is to convert to MP3, for video files, reduce the resolution of the video (and in some cases) use a codec with better video compression (for example MPEG).,Yes, Any Video Converter has successfully passed the safety test.,Show more,winx free vob to mp4 converter,handbrake vob to mp4,best free video conversion software,video converter toptenreviews,pc software converter,best vhs video converter,video converter with quality,best 2d to 3d converter software review,best video transfer software,best online video converter,free mkv to mp4 converter windows 10,video container switcher,mac video container switcher,convert 10-bit mkv to mp4,digiarty video converter,video converter free download for windows 10,freemake video converter,any video converter,handbrake video converter,best free video converter online,top video converter software