androidxml-rpcnoclassdeffounderrorxmlrpclibxmlrpcclient

NoClassDefFoundError: org.apache.xmlrpc.client.XmlRpcClient


I've started developing with XML-RPC in Android but since I've added the JAR files I keep getting this error when I click on my button:

java.lang.NoClassDefFoundError: org.apache.xmlrpc.client.XmlRpcClient

I always get it when I click on the button with this code:

public void addListenerOnButton() {

    button = (Button) findViewById(R.id.button1);

    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            final String url = "http://www.myUrl.com:8069/";
            final String db = "dbname";
            final String username = "username";
            final String password = "password";

            final XmlRpcClient client = new XmlRpcClient();

            final XmlRpcClientConfigImpl start_config = new XmlRpcClientConfigImpl();
            /*Toast.makeText(MainActivity.this, 
                    "Your Message", Toast.LENGTH_LONG).show();*/
        }
    });
}

I've added the external JAR files org-apache-xmlrpc, xmlrpc-3.0a1 and xmlrpc-client as you can see here:

And this is the problem that keeps popping up:

Can anybody explain me what I'm doing wrong and how I can fix this please? I'm really stuck on this one.

Thanks Yenthe


Solution

  • It turned out that I had to include another JAR file for the XML-RPC. You can download all these JAR files here: http://archive.eu.apache.org/dist/ws/xmlrpc/apache-xmlrpc-current-bin.zip

    After downloading all these JAR files you should all place them under libs and then clean your project. Then it is solved.