0

I am trying to use org.apache.commons.collections.CollectionUtils in android with following code

import java.util.ArrayList;

import org.apache.commons.collections.CollectionUtils;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class CheckCommonsActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    String email1 = "xyz@gmail.com";
    String email2 = "abc@gmail.com";
    String email3 = "mnp@gmail.com";
    String email4 = null;       

    ArrayList<String> emailList1 = new ArrayList<String>();
    emailList1.add(email4);
    emailList1.add(email1);
    emailList1.add(email2);
    emailList1.add(email3);

    ArrayList<String> emailList2 = new ArrayList<String>();
    emailList2.add(email3);
    emailList2.add(email2);
    emailList2.add(email1);

    boolean isEqual = CollectionUtils.isEqualCollection(emailList1,
           emailList2);
    TextView text = (TextView) findViewById(R.id.text);
    text.setText(String.valueOf(isEqual));
    }
 }

I am getting following error message in Console Conversion to Dalvik format failed with error 1. Complete Message trail is uploaded here.

Gaurav Agarwal
  • 18,754
  • 29
  • 105
  • 166

1 Answers1

1

Your code is okay. It seems like a jar files conflict. Have a look here. Can have several reasons why that error raises..one of the solutons there may help you too

Edit: Assuming from your question here: You added the lib from /libs folder as I descibed there but you forgot to delete the "old" reference to your external library in build path. So you probably include the same library twice. Remove the reference of your external jar from build path

Community
  • 1
  • 1
207
  • 3,784
  • 2
  • 25
  • 22