Ishaq Kamran
Ishaq Kamran

Reputation: 223

Resolving dependency configuration 'implementation' is not allowed as it is defined as 'canBeResolved=false'

I am trying to run a react native project but its gradle is not working correctly. This is the error.

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:\Workspace\New Folder (2)\node_modules\@babylonjs\react-native\android\build.gradle:117)
    at build_8wyks54mb6cye9xs3jcg9t1xg$_run_closure4.doCall(G:\Workspace\New Folder (2)\node_modules\@babylonjs\react-native\android\build.gradle:114)

Here is where the problem occurs

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'
    }

Kindly Somebody tells me why is the error showing I dont have any idea what is going on. Somebody please help me I will be very thankful.

Upvotes: 13

Views: 7637

Answers (1)

squid233
squid233

Reputation: 166

You should use the code this below:

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

That may helpful for you.

Upvotes: 2

Related Questions