在 Android Studio 中编辑外部库 [英] Editing external libraries in Android Studio
本文介绍了在 Android Studio 中编辑外部库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用从 github 中获取的图像轮播库,但我想在代码中更改一些内容.我已经使用 compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+' 命令导入了它.该代码是否可供我以某种方式进行编辑?还是每次运行我的代码都从github下载?
I am using an image carousel library that I snagged off of github, but there are a few things I would like to change in the code. I have imported it using the compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+' command. Is that code available for me to edit somehow? Or is it downloaded from github every time I run my code?
推荐答案
为此,您需要将其导入为 lib 并根据需要进行修改:
For this you need to import it as lib and modify as you like:
要将库导入 Android Studio,有两种方法可以工作.
To import the library to Android Studio, there are two methods that can work.
- 在 Android Studio 中打开您的项目
- 下载库(使用 Git 或 zip 存档解压)
- 在您的项目中创建一个文件夹subProject"
- 将 FreemiumLibrary 文件夹复制并粘贴到您的子项目文件夹
- 在项目目录的根目录下创建/修改 settings.gradle 文件.它应该包含如下内容:
include 'MyApp', ':subProject:FreemiumLibrary'
- gradle clean &构建/关闭项目并重新打开/重新导入它.
- 编辑项目的 build.gradle 以将其添加到依赖项"部分:
dependencies {
//...
compile project(':subProject:FreemiumLibrary')
}
- 编辑您的应用活动以扩展 AdsFragmentActivity 而不是活动.
- 如果您想与 ActionBarCompat 一起使用,请编辑库
方法 2:
- 在 Android Studio 中打开您的项目
- 下载库(使用 Git 或 zip 存档解压)
- 转到文件 > 新建 > 导入模块并将库作为模块导入
- 在项目视图中右键单击您的应用并选择打开模块设置"
- 点击依赖项"标签,然后点击+"按钮
- 选择模块依赖"
- 选择免费增值图书馆"(不是免费增值图书馆项目)
- 修改您的应用活动以扩展 AdsFragmentActivity 而不是活动.
- 如果您想与 ActionBarCompat 一起使用,请修改库
这篇关于在 Android Studio 中编辑外部库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文