本文介绍了如何在android studio中编辑依赖/外部库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多关于添加库和依赖项的信息,但是我无法找到有关能够实际编辑库的任何有用信息。

There is a lot of information about adding libraries and dependencies, but I haven't been able to find any useful information on being able to actually edit a library.

我在我的项目中添加了作为依赖项,但我想编辑它的一些功能,主要是布局相关的东西。但是,当我进入浏览文件时,Android Studio说
构建文件夹下的文件已生成且不应编辑,当我编辑它们时,一旦系统构建,它们将返回到预编辑状态。

I have added https://github.com/jdamcd/android-crop as a dependency in my project, but I would like to edit some of its features, mostly layout related stuff. However, when I go into browse the files Android Studio says"files under the build folder are generated and should not be edited" and when I edit them they are returned back to their pre-edited state once the system builds.

我也尝试在notepad ++中编辑文件,同样的问题也出现了(它们会在构建时返回到预先编辑的状态)。

I also tried editing the files in notepad++ and the same problem occurs (they are returned to their pre-edited state on build).

有人可以告诉我如何编辑库或我可以更改布局/某些java的解决方法,而无需将整个库复制并粘贴到我的项目中让它可编辑?

Can someone tell me either how to edit the library or a workaround whereby I can change the layouts/some java without having to copy and paste the entire library into my project to make it editable?

提前致谢,

上帝的速度。

编辑:答案不是简单地使用以下代码将库作为依赖项添加到build.gradle文件中:compile'c​​om.soundcloud.android: android-crop:0.9.10 @aar'

您必须将其添加为模块而不仅仅是外部依赖项,然后您可以编辑文件。

如果有人想知道如何执行以下步骤:


  1. 在根目录中创建库文件夹(在任何你想要的地方调用它),即你进入应用程序及其内容的第一个文件夹。

  2. 下载库,解压缩。

  3. 将步骤2中的文件夹放入您在步骤1中创建的文件夹中。

  4. 将模块添加到 settings.gradle ,如下所示:
    include':LibraryContainingFolder:ActualLibFolder'

  5. 同步并清理

  6. 转到Android Studio的项目结构,点击主模块,通常称为app,点击依赖项标签,然后单击绿色加号,然后单击模块依赖关系。
    该模块应该显示为包含文件夹,其中的库文件夹由冒号'somethingElse'分隔。添加模块。

  7. 同步,清理,建立等。

  1. Create library folder (call it whatever you want) in the root directory, i.e. the first folder you go into to get to the app and its contents.
  2. Download the library, unzip it.
  3. Put the folder from step 2 in the folder you created in step 1.
  4. Add the module to the settings.gradle like so:include ':LibraryContainingFolder:ActualLibFolder'
  5. Sync and clean
  6. Go to project structure in Android Studio, click on the main module, normally called app, click on dependencies tab, then click the green plus, then click "Module dependency".The module should appear written as the containing folder and the library folder in it separated by colons 'something:somethingElse'. Add the module.
  7. Sync, clean, buid etc.


推荐答案

您应该将库添加为Android Studio中的模块,方法是从您感兴趣的Github存储库中下载代码(并删除您添加到的依赖项下的行) build.gradle

You should add the library as a module in Android Studio, by downloading the code from the Github repository you're interested in (and removing the line under dependencies that you added to build.gradle)

然后按照以下答案中的步骤操作:

Then follow the steps in this answer: https://stackoverflow.com/a/16639227/1065810

这篇关于如何在android studio中编辑依赖/外部库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 20:33