-1

I would like to send a post request to send data to my worksheet by Google Form

I use Android Studio, in my android project I have an error when I try to execute DefaultHttpClient object I get :

--------- beginning of crash 10-26 16:19:08.749 21824-22874/mypackage E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-1553 Process: mypackage, PID: 21824 java.lang.NoSuchMethodError: No virtual method execute(Lorg/apache/http/client/methods/HttpUriRequest;Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/client/methods/CloseableHttpResponse; in class Lorg/apache/http/impl/client/DefaultHttpClient; or its super classes (declaration of 'org.apache.http.impl.client.DefaultHttpClient' appears in /system/framework/org.apache.http.legacy.boot.jar)

the error is reported to the line: response = httpClient.execute(httpPost,localContext);

I use httpclient-4.5.1.jar library

minSDK: API 15: Android 4.0.3 (IceCreamSandwich)

I don't know how to fix this! Please Help Me!

9

1 Answer 1

11

in build.gradle android section put this code
useLibrary 'org.apache.http.legacy'

Sign up to request clarification or add additional context in comments.

2 Comments

grt answer, i ws stuck @Din Islam Milon
Simple but helpful answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.