android - 如何将模块包含到项目中?

标签 android

有一个库

https://github.com/Yalantis/uCrop

有 2 个模块 Sampleucrop - 所有逻辑都位于这里

问题是 - 当我将 ucrop 模块复制到我的项目时也添加了这个

dependencies {
...
 implementation project(':ucrop')
....
}

还有这个

settings.gradle include ':ucrop', ':app'

据我所知,我只需要添加这一行即可将新模块包含到项目中

然后我试图编译应用程序并得到这样的错误

Resolving this BuildableArtifact can only done during task execution.

The module 'ucrop' is an Android project without build variants, and cannot be built. Please fix the module's configuration in the build.gradle file and sync the project again.

我的项目不想包含新模块的原因是什么?

欢迎提问

谢谢

最佳答案

克隆要作为模块包含的存储库。

提供克隆存储库的路径。 现在假设我想在我的项目中包含日历模块。

1.现在进入android studio 点击File->New->Import module。

2.将这一行添加到app的build.gradle

implementation project(':calender')

3.将这一行添加到settings.gradle。

include ':calendar'

编辑:您还需要修改模块的 build.gradle 文件。在构建类型下,您需要添加此行

flavorDimensions "default"

关于android - 如何将模块包含到项目中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53931937/

相关文章:

android - picasso - 将图像加载到适配器中的图像按钮

android - 如何在 Eclipse 中安装 Android 4.0 (API 14)?

android - MapBox SDK如何获取marker的点击事件?

android - 如何允许在 Android 的 PopupWindow 中滚动

android - 从 ExifInterface 获取旋转总是返回 0

android - 在哪里可以找到 Android 4.1+ 通知栏中的 "clear all"图标

java - 在按钮单击触发器上将微调器值传递给另一个 Activity

javascript - 在 Android 应用程序 Web View 中运行自定义 JavaScript

java - 在 GraphicalView 对象上调用 ZoomReset 不起作用

android - "The layout has no declaration in the base layout folder"