Android的运行时错误" java.lang.NoClassDefFoundError的:org.apache.commons.collections.CollectionUtils" [英] Android Runtime Error "java.lang.NoClassDefFoundError: org.apache.commons.collections.CollectionUtils "

查看:204
本文介绍了Android的运行时错误" java.lang.NoClassDefFoundError的:org.apache.commons.collections.CollectionUtils"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Android中使用org.apache.commons.collections.CollectionUtils。样品低于

I am trying to use org.apache.commons.collections.CollectionUtils in Android. The sample is below

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));
   }
 }

我已经导入commons-collections提供-3.2.1.jar构建Android项目的路径,但我得到的错误 java.lang.NoClassDefFoundError的:org.apache.commons.collections.CollectionUtils 在运行时。

EDIT1

感谢

推荐答案

您必须把库/库(而不是/ lib)中的文件夹你的Andr​​oid项目

You have to put the library in /libs (not /lib) folder of your android project

编辑:我是假设你把它放在/ lib文件夹中,因为这是一个常见的​​故障。在您添加的截图可以看出,包括你的lib外部罐子。 Anyway..whether你把它放在/ lib或外部罐子的解决方案是相同的:创建/ libs文件夹,把LIB有

I was assuming that you put it in /lib folder because this is a common failure. In your added screenshot can be seen that you included the lib as external jar. Anyway..whether you put it in /lib or as external jar the solution is the same: create /libs folder and put the lib there

这篇关于Android的运行时错误&QUOT; java.lang.NoClassDefFoundError的:org.apache.commons.collections.CollectionUtils&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆