不允许解析依赖项配置'implementation',因为它被定义为'canBeResolved=false'



我正在尝试运行一个react native项目,但它的gradle不能正常工作。这是错误。

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':babylonjs_react-native'.
Caused by: java.lang.IllegalStateException: Resolving dependency configuration 'implementation' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'implementation' should be resolved.
at build_8wyks54mb6cye9xs3jcg9t1xg$_run_closure4$_closure12.doCall(G:WorkspaceNew Folder (2)node_modules@babylonjsreact-nativeandroidbuild.gradle:117)
at build_8wyks54mb6cye9xs3jcg9t1xg$_run_closure4.doCall(G:WorkspaceNew Folder (2)node_modules@babylonjsreact-nativeandroidbuild.gradle:114)

这里是问题发生的地方

afterEvaluate { project ->
// some Gradle build hooks ref:
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath)
classpath += files(project.getConfigurations().getByName('implementation').asList())
include '**/*.java'
}

请告诉我为什么会出现错误我不知道发生了什么事。谁来帮帮我,我将非常感激。

您应该使用下面的代码:

classpath += files(configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) })

那可能对你有帮助。

相关内容

最新更新