我可以按照 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')
}
...
一些解释:
build.gradle
服务于其他模块的文件build.gradle
文件 settings.gradle
中公开了很多模块文件。我不知道如何调用和使用它们。 最佳答案
您可以使用 Gradle Composite builds 来实现此目的。 ,Gradle 3 中添加的一个功能。有很多方法可以配置它,但要包括本地构建的第三方库(如 fresco),您可以通过 cli 进行设置:./gradlew assembleDebug --include-build <path/to/local/fresco/>
由于它将项目分开,因此 fresco 构建的结构无关紧要,您无需修改 react 项目的 settings.gradle
或 build.gradle
.包含的构建将提供依赖项并替换远程版本。
关于android - 如何通过 Gradle 将 Fresco 源代码添加到另一个项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48953996/