I have develop Android Login Registration System with PHP, MySQL. This is Simple questions but confuses me. i got many error as below log.
Caused by: java.lang.NoSuchMethodError: org.apache.http.impl.client.DefaultHttpClient.execute at com.chinatown.wangjian.chinatown_loginv10.Library.JSONParser.getJSONFromUrl(JSONParser.java:45) at com.chinatown.wangjian.chinatown_loginv10.Library.UserFunctions.loginUser(UserFunctions.java:42) at com.chinatown.wangjian.chinatown_loginv10.Login$ProcessLogin.doInBackground(Login.java:194) at com.chinatown.wangjian.chinatown_loginv10.Login$ProcessLogin.doInBackground(Login.java:170) at com.chinatown.wangjian.chinatown_loginv10.Register$ProcessRegister.onPreExecute(Register.java:197) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586) at android.os.AsyncTask.execute(AsyncTask.java:534) at com.chinatown.wangjian.chinatown_loginv10.Register$NetCheck.onPostExecute(Register.java:167) at com.chinatown.wangjian.chinatown_loginv10.Register$NetCheck.onPostExecute(Register.java:119) >at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586) at android.os.AsyncTask.execute(AsyncTask.java:534) at com.chinatown.wangjian.chinatown_loginv10.Login$NetCheck.onPostExecute(Login.java:159) at com.chinatown.wangjian.chinatown_loginv10.Login$NetCheck.onPostExecute(Login.java:110)
there are part of my java code:
JSONParser.java
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
UserFunctions
public JSONObject registerUser(String mobile, String email, String uname, String password){
// Building Parameters
List params = new ArrayList();
params.add(new BasicNameValuePair("tag", register_tag));
params.add(new BasicNameValuePair("mobile", mobile));
params.add(new BasicNameValuePair("email", email));
params.add(new BasicNameValuePair("uname", uname));
params.add(new BasicNameValuePair("password", password));
JSONObject json = jsonParser.getJSONFromUrl(registerURL,params);
return json;
}
Register.java
private class ProcessRegister extends AsyncTask<String, String, JSONObject> {
private ProgressDialog pDialog;
String email,password,mobile,uname;
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
inputUsername = (EditText) findViewById(R.id.uname);
inputPassword = (EditText) findViewById(R.id.password);
mobile = inputMobile.getText().toString();
email = inputEmail.getText().toString();
uname= inputUsername.getText().toString();
password = inputPassword.getText().toString();
pDialog = new ProgressDialog(Register.this);
pDialog.setTitle("正在链接服务器");
pDialog.setMessage("注册中 ...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected JSONObject doInBackground(String... args) {
UserFunctions userFunction = new UserFunctions();
JSONObject json = userFunction.registerUser(mobile, email, uname, password);
return json;
}
private class NetCheck extends AsyncTask<String,String,Boolean>
{
private ProgressDialog nDialog;
@Override
protected void onPreExecute(){
super.onPreExecute();
nDialog = new ProgressDialog(Register.this);
nDialog.setMessage("加载中..");
nDialog.setTitle("正在检查网络");
nDialog.setIndeterminate(false);
nDialog.setCancelable(true);
nDialog.show();
}
I have refer the website try to fixed https://community.oracle.com/thread/2279492?start=0 and upgrade the httpcore-4.1.jar to latest version as below libs folder image. but it is not work for my project. I'm a newbie at this stuff so any help will be appreciated. Thanks in Advance!