在Android Studio中编辑外部库 [英] Editing external libraries in Android Studio

查看:139
本文介绍了在Android Studio中编辑外部库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我从github上抢过的图像轮播库,但是我想在代码中进行一些更改.我已经使用编译'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.

  1. 在Android Studio中打开您的项目
  2. 下载库(使用Git或zip压缩文件解压缩)
  3. 在项目中创建一个文件夹"subProject"
  4. 将FreemiumLibrary文件夹复制并粘贴到您的subProject文件夹中
  5. 在项目目录的根目录上,创建/修改settings.gradle文件.它应包含如下内容:

include 'MyApp', ':subProject:FreemiumLibrary'

  1. 逐步清洁&构建/关闭项目,然后重新打开/重新导入它.
  2. 编辑项目的build.gradle,以将其添加到依赖项"部分:

dependencies {
//...
    compile project(':subProject:FreemiumLibrary')
}

  1. 编辑您的应用活动,以扩展AdsFragmentActivity而不是活动.
  2. 如果要与ActionBarCompat一起使用,请编辑该库

方法2:

  1. 在Android Studio中打开您的项目
  2. 下载库(使用Git或zip压缩文件解压缩)
  3. 转到文件">新建">导入模块",然后将库作为模块导入
  4. 在项目视图中右键单击您的应用,然后选择打开模块设置"
  5. 点击依赖项"标签,然后点击"+"按钮
  6. 选择模块依赖性"
  7. 选择免费增值图书馆"(不是免费增值图书馆项目)
  8. 修改您的应用活动,以扩展AdsFragmentActivity而不是活动.
  9. 如果要将其与ActionBarCompat一起使用,请修改库
  1. Open your project in Android Studio
  2. Download the library (using Git, or a zip archive to unzip)
  3. Go to File > New > Import-Module and import the library as a module
  4. Right-click your app in project view and select "Open Module Settings"
  5. Click the "Dependencies" tab and then the '+' button
  6. Select "Module Dependency"
  7. Select "Freemium Library" (not Freemium Library Project)
  8. Modify your App Activities to extend AdsFragmentActivity instead of Activity.
  9. Modify the library if you want to use it with ActionBarCompat

这篇关于在Android Studio中编辑外部库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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