React-native-reanimated: Getting build error with v1.1.0 (Android)

Created on 19 Jun 2019  路  8Comments  路  Source: software-mansion/react-native-reanimated

With the release of v1.1.0, I am getting below mentioned error when building my react native android app

A problem occurred configuring project ':react-native-reanimated'.
> Could not get unknown property 'javaCompileProvider' for object of type com.android.build.gradle.internal.api.LibraryVariantImpl.

Most helpful comment

The below mentioned code inside build.gradle is problematic:

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
            from variant.javaCompileProvider.get().destinationDir
        }
}

If this is replaced with the below mentioned code, the said problem is fixed.

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
            from variant.javaCompile.destinationDir
        }
}

All 8 comments

The below mentioned code inside build.gradle is problematic:

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
            from variant.javaCompileProvider.get().destinationDir
        }
}

If this is replaced with the below mentioned code, the said problem is fixed.

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
            from variant.javaCompile.destinationDir
        }
}

@gmaclennan This is what I have done in the interim. Though would expect a the lib to fix the issue.

Similar to https://github.com/kmagiera/react-native-screens/issues/124, you're probably still using a Gradle version below 4.10. As noted in the PR that made this change only 4.10>= is supported.

The below mentioned code inside build.gradle is problematic:

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
            from variant.javaCompileProvider.get().destinationDir
        }
}

If this is replaced with the below mentioned code, the said problem is fixed.

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
            from variant.javaCompile.destinationDir
        }
}

Thanks its worked

how do i find this file, in my project does not contain that code shown above, when having add this line of code in my build.gradle from android folder, the project shows more error

how do i find this file, in my project does not contain that code shown above, when having add this line of code in my build.gradle from android folder, the project shows more error

you should find 'node_modules\react-native-reanimated\androidbuild.gradle' and edit it

The below mentioned code inside build.gradle is problematic:

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
            from variant.javaCompileProvider.get().destinationDir
        }
}

If this is replaced with the below mentioned code, the said problem is fixed.

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
            from variant.javaCompile.destinationDir
        }
}

its work for me

Please check gradle wrapper version in android/gradle/wrapper/gradle-wrapper.properties, and make sure it's in sync with RN version you use. Gradle moving towards lazy configuration, and provider pattern, therefore introduced many *Provider classes lately.

Was this page helpful?
0 / 5 - 0 ratings