Could not find class 'org.json.simple.parser.JSONParser' - Android
<p>I am having an Android activity in a package say com.blah.blah1 and a java class in another package say com.blah.blah2 , I am trying to access the java class from the activity, but it is throwing error as </p>

<blockquote>
  <p>02-06 14:35:03.360: E/dalvikvm(580): Could not find class
  'org.json.simple.parser.JSONParser', referenced from method
  com.blah.blah2.Login.login</p>
</blockquote>

<p>Please help resolve</p>

<ul>
<li>I am using eclipse </li>
<li>My jars are in libs folder</li>
<li>I have added the json    jar to the build path </li>
<li>I am using jar json-simple-1.1.jar</li>
<li>I am working under Android 4.0.3</li>
<li>eclipse java compiler version 1.6</li>
</ul>

<p>please find below the activity and java class for you reference</p>

<pre><code>public class Chat_NewActivity extends Activity {

    private String className = "Chat_NewActivity";

    /** Asyn parameters */
    private String response;

    /** login() parameters */
    LinkedHashMap&lt;String,String&gt; parameters ;
    String responseToAsync = null;
    UrlRequestAndResponse request = null;
    static ResponseParameters param = null;
    static String userId = null;
    static String secureKey = null;
    static String status = null;
    static String sessionId = null;

    /** Called when the activity is first created and loads main.xml content */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        Log.i(className, "Creating mail layout for the app...");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.i(className, "Created");
    }

    /** action for items selected in Preferences menu */
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
        case R.id.settings_menu:
            Intent settingsActivity = new Intent(getBaseContext(),
                    Chat_PreferenceActivity.class);
            startActivity(settingsActivity);
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }

    /** action calling on Start Chat button is clicked */
    public void startChat(View view) {
        Log.i(className, "Start Chat button is clicked");
        Log.i(className, "performing action for staring chat");
        Log.i(className, "performing user validation");
        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
        Chat_AppInfo.pref_email = sharedPref.getString("email",null);
        if (Chat_AppInfo.pref_email != null &amp;&amp; Chat_AppInfo.pref_email.matches("[a-zA-Z0-9._-]+@[a-z]+.[a-z]+") 
                &amp;&amp; Chat_AppInfo.pref_email.length() &gt; 0) {

            /** Intent i = new Intent(getApplicationContext(), AppActivity.class); */

            Chat_AppInfo.pref_firstName = sharedPref.getString("firstName",null).toString();
            Chat_AppInfo.pref_lastName = sharedPref.getString("lastName",null).toString();
            EditText getsubject = (EditText) findViewById(R.id.subject);
            Chat_AppInfo.pref_subject = getsubject.getText().toString();
            Log.i(className, "first name : "+Chat_AppInfo.pref_firstName);
            Log.i(className, "last name : "+Chat_AppInfo.pref_lastName);
            Log.i(className, "last name : "+Chat_AppInfo.pref_email);
            Log.i(className, "subject : "+Chat_AppInfo.pref_subject);
            if(Chat_AppInfo.pref_firstName != null || 
                    Chat_AppInfo.pref_lastName != null ||
                    Chat_AppInfo.pref_subject.length() &gt; 0) {
                Log.i(className, "validation completed!!!");
                checkNetworkConnection();
                /**i.putExtra(AppInfo.firstName, get_FirstName_From_Pref);
                i.putExtra(AppInfo.lastName, get_LastName_From_Pref);
                i.putExtra(AppInfo.email, get_MailId_From_Pref);
                i.putExtra(AppInfo.connection_Url, get_MailId_From_Pref);
                i.putExtra(AppInfo.subject, subject);
                startActivity(i);*/
            } else {
                Toast.makeText(getApplicationContext(), "Insufficient Credentials", Toast.LENGTH_SHORT).show();
            }
        } else {
            Toast.makeText(getApplicationContext(), "E-mail is Invalid!!!", Toast.LENGTH_SHORT).show();
        }
    }

    protected void checkNetworkConnection() {
        Log.i(className, "Checking for Network / wi-fi connection!!!");
        ConnectivityManager connMgr = (ConnectivityManager) 
        getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
        if (networkInfo != null &amp;&amp; networkInfo.isConnected()) {
            Log.i(className, "Network connection available!!!");
            new AsyncConnectionEstablisher().execute(Chat_AppInfo.service_url+"LoginAction");
        } else {
            Log.i(className, "Network connection not available!!!");
            Toast.makeText(getApplicationContext(), "Network Connection Not Available", Toast.LENGTH_SHORT).show();
        }
    }

    private class AsyncConnectionEstablisher extends AsyncTask&lt;String, Void, String&gt; {

        protected String doInBackground(String... urls) {
            // params comes from the execute() call: params[0] is the url.
            Log.i(className, "Performing asynchronous connection...");
            String output = null;
            for (String url : urls) {
                output = getOutputFromUrl(url);
            }
            return output;
        }

        private String getOutputFromUrl(String url) {
            String output = null;
            try {
                Login createSessionObj = new Login();
                createSessionObj.login(url);
                output = createSessionObj.sessionId(Chat_AppInfo.service_url+"JoinAction");
                //output = login(url);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return output;
        }
        // onPostExecute displays the results of the AsyncTask.
        protected void onPostExecute(String result) {
            Log.i(className, "response is : "+result);
        }
    }
}

import java.io.IOException;
import java.util.LinkedHashMap;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import android.util.Log;

public class Login {

    private String className = "Login";
    LinkedHashMap&lt;String,String&gt; parameters ;
    String responseToAsync = null;
    UrlRequestAndResponse request = null;
    String response;
    static ResponseParameters param = null;
    static String userId = null;
    static String secureKey = null;
    static String status = null;
    static String sessionId = null;

    public void login(String url) {
        Log.i(className, "Calling login action with service URL : "+url);
        parameters = new LinkedHashMap&lt;String,String&gt;();
        parameters.put("firstname", Chat_AppInfo.pref_firstName);
        parameters.put("lastname", Chat_AppInfo.pref_lastName);
        parameters.put("email", Chat_AppInfo.pref_email);
        parameters.put("subject", Chat_AppInfo.pref_subject);

        request = new UrlRequestAndResponse();
        request.setUrlRequestParameters(url, parameters, null);
        request.convertStreamToJson();
        response = request.getUrlResponseJson();
        try {
            JSONObject json = (JSONObject)new JSONParser().parse(response);
            param.setUserId((String) json.get("userId"));
            param.setSecureKey ((String) json.get("secureKey"));
            param.setStatus((String) json.get("status"));

        } catch (NullPointerException e) {
            System.out.println("Properly set the setUrlRequestParameters(url, parameters, header) , convertStreamToJson() in the request...");
        } catch (ParseException e) {
            System.out.println("Parse the JSON String properly... Or Check the Servlet Response is in JSON format...");
        }

        try {
            userId  = param.getUserId();
            secureKey = param.getSecureKey();
            status = param.getStatus();
            Log.i(className, "{\"userId\":\""+userId+"\",\"secureKey\":\""+secureKey+"\", \"status\":\""+status+"\"} ");
            //sessionId(Chat_AppInfo.service_url+"JoinAction");
        } catch (NullPointerException e) {
            System.out.println("Check the parameters in response...");
        }
    }
}
</code></pre>
