如何在 Android Studio (Gradle) 中添加 apache commons 集合 [英] How to add apache commons collections in Android Studio (Gradle)

查看:167
本文介绍了如何在 Android Studio (Gradle) 中添加 apache commons 集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 ListUtils但是当我运行该应用程序时出现此错误:

Im trying to use ListUtils but when I ran the app I got this error:

 Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.collections.ListUtils" on path: DexPathList[[zip file "/data/app/com.meridianaspect.wiw-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

所以我想我必须以某种方式通过 gradle 导入该库,但我不知道该怎么做?

So I guess I have to import that library via gradle somehow, but I dont know how to do that?

推荐答案

将 jar 文件放在模块根目录的 libs 文件夹中.然后文件-> 项目设置.在左侧选择要添加此库的模块,在右侧选择选项卡依赖项.在底部按加号并单击文件依赖项.然后选择你的 jar 并同步项目

Place the jar file in the libs folder in the root of your module. Then File -> Project Settings. In the left side choose the module where you want to add this lib, in the right side choose tab Dependencies. In the bottom press Plus sign and click File dependency. Then choose your jar and sync project

这篇关于如何在 Android Studio (Gradle) 中添加 apache commons 集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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