android - 如何通过 Gradle 将 Fresco 源代码添加到另一个项目中

标签 android gradle build build.gradle fresco

我可以按照 its own official site 的指示从源代码构建 Fresco .

但是我不能将它的源代码作为项目添加到我的 build.gradle 中。 .

在尝试构建项目时,它会引发如下异常:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':ReactAndroid'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':ReactAndroid:_debugPublish'.
      > Configuration with name 'default' not found.
   > Could not resolve all dependencies for configuration ':ReactAndroid:compile'.
      > Configuration with name 'default' not found.

有没有机会克服这个问题?
settings.gradle应用程序文件:
include ':app'

include ':fresco'
project(':fresco').projectDir = new File(rootProject.projectDir, '../fresco')
build.gradle应用程序文件:
...
dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:27.0.+"

        compile project(':ReactAndroid')
        compile project(':fresco')
}
...

一些解释:
  • Fresco有一个主要的 build.gradle 服务于其他模块的文件build.gradle文件
  • 它还在自己的 settings.gradle 中公开了很多模块文件。我不知道如何调用和使用它们。
  • 最佳答案

    您可以使用 Gradle Composite builds 来实现此目的。 ,Gradle 3 中添加的一个功能。有很多方法可以配置它,但要包括本地构建的第三方库(如 fresco),您可以通过 cli 进行设置:./gradlew assembleDebug --include-build <path/to/local/fresco/>由于它将项目分开,因此 fresco 构建的结构无关紧要,您无需修改​​ react 项目的 settings.gradlebuild.gradle .包含的构建将提供依赖项并替换远程版本。

    关于android - 如何通过 Gradle 将 Fresco 源代码添加到另一个项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48953996/

    相关文章:

    java - GridView 图像链接到 Activity

    android - 导入项目(Eclipse ADT,Gradle等)选项在Android Studio 2.3.2中不会退出

    spring-boot - 将 Gradle 属性注入(inject) Spring Boot application.yml,在 IntelliJ IDEA 中不起作用

    delphi - 如何在 Delphi 中拥有依赖于构建的图标

    docker build 错误检查上下文 : 'can' t stat '\\?\C:\Users\username\AppData\Local\Application Data' '

    android - 在 Android Studio 中添加构建 SVN 修订号

    android - 右侧的 float 操作菜单

    android - 适用于 Mosync IDE 的 Genymotion Android 模拟器插件

    html - 如何让 Gradle 构建生成 HTML 测试报告而不是默认的 XML?

    gradle - 如何将应用的 gradle 脚本的执行推迟到构建脚本的最后一个