react-native-reanimated: Build on android fails for version 2.2.1

Description

when running cd android && ./gradlew clean && cd .. && react-native run-android --variant=devDebug --appIdSuffix=dev I get the following error:

FAILURE: Build failed with an exception.

* Where:
Build file 'my-app/node_modules/react-native-reanimated/android/build.gradle' line: 85

* What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.
> Task with path ':app:mergeDebugNativeLibs' not found in project ':app'.

see in diff

Expected behavior

Should not crash

Actual behavior & steps to reproduce

Update from 2.2.0 to 2.2.1

Snack or minimal code example

Package versions

  • React Native: "react-native": "0.64.2",
  • React Native Reanimated: "react-native-reanimated": "^2.2.1",
  • NodeJS: v16.8.0
  • Xcode: N/A
  • Java & Gradle: N/A

Affected platforms

  • Android
  • iOS
  • Web

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 15
  • Comments: 42 (2 by maintainers)

Commits related to this issue

Most upvoted comments

v2.2.2 fixed the issue for us

None of the above worked for me. I’m getting this error in any version > 2.1.0 😕

Thanks for all of the hints. I’ve submitted a detailed pull request with a fix for this issue: https://github.com/software-mansion/react-native-reanimated/pull/2564

I’m on 64.2 and having the same issue. I rolled back to 2.2.0, which is working fine.

still have it with 2.2.2 I’m afraid. I tried both 😞 we don’t use expo which that fix seemed to be targeted at?

@tijs I am having the same failure as the author of this issue (and also on 2.2.2).

I’m seeing this in the logs on our CI/CD: Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.

Does this point to an issue in react-native-reanimated or could this have to do with out own project (which does noet yet use Gradle 7)?

Edit: Reverting to 2.2.0 resolves the issue. So problem must have been introduced with 2.2.1. Which makes sense given that the mergeNativeLibs tasks were added there, see diff.

Same basic issue, none of the above suggestions resolve it except downgrading to 2.2.0

Build file 'node_modules/react-native-reanimated/android/build.gradle' line: 76

A problem occurred evaluating project ':react-native-reanimated'.
> Task with path ':app:mergeDebugNativeLibs' not found in project ':app'.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':react-native-reanimated'.
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133)
	at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:136)
	at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
....etc

we already had the packagingOptions in our app/build.gradle. this is RN 0.63.4 manually upgraded with upgrade helper throughout the years (so if we missed some new gradle task I would love to know 😁)

I am currently using react-native version 0.64.2 and I am currently having the same problem. I downgraded to version 2.2.0 of react-native-reanimated to be able to build my app.

I can confirm that version 2.2.1 works with react-native 0.65.1

I ran into this when wanting to create a new production release.

I produce Android App Bundles for the Play Store, not APKs. The task for that bundleProductionRelease for me, but bundle isn’t matched against by the new build.gradle file of react-native-reanimated.

To fix that:

diff --git a/node_modules/react-native-reanimated/android/build.gradle b/node_modules/react-native-reanimated/android/build.gradle
index 18ee54a..a3f6fb7 100644
--- a/node_modules/react-native-reanimated/android/build.gradle
+++ b/node_modules/react-native-reanimated/android/build.gradle
@@ -31,7 +31,7 @@ abstract class replaceSoTask extends DefaultTask {
 def getCurrentFlavor() {
     Gradle gradle = getGradle()
     String taskRequestName = gradle.getStartParameter().getTaskRequests().toString()
-    Pattern pattern = Pattern.compile("(assemble|install|generate)(\\w+)(Release|Debug)")
+    Pattern pattern = Pattern.compile("(assemble|install|bundle|generate)(\\w+)(Release|Debug)")
     Matcher matcher = pattern.matcher(taskRequestName)
 
     if(matcher.find()) {

I can now produce the bundle I need, which is good.

However, every other Gradle command is broken, e.g. gradlew clean.

Every time I need to do a clean I have to first delete react-native-reanimated from my node_modules so the above script does not run.

Having the same issue with “react-native-reanimated”: “^2.3.0-beta.2” and “react-native”: “0.62.2”. Tired downgrading the version and also tried the temporary fix but none worked for me. any updates??

Downgrading to react-native-reanimated version to 2.1.0 (from 2.2.0) worked for me. I’m using react-native 0.64.2 (without expo). Some people mentioned downgrading to 2.2.0 worked for them, but it didn’t for me.

I’m getting the same error on 0.62.0 My app is hybrid and the packageOptions solution will definitely increase the apk size, so I would not like to go with that. I am getting an error on iOS as well when trying to use reanimated.

Rolling back to 2.2.0 fixes everything.

I’m on 64.2 and having the same issue. I rolled back to 2.2.0, which is working fine.

I use react-native 63.4 and react-native-reanimated 2.2.0 , but it does not build and gives such an error:

A problem occurred evaluating project ':react-native-reanimated'.
Task with path ':app:mergeDebugNativeLibs' not found in project ':app'.

Doing a global search for mergeNativeLibs doesn’t show any results.

Yeah, I have barely a clue on where it comes from. Doing a quoted Google search shows this, which is not very useful. To my understanding, it’s related to Android’s NDK, but specifying it in my Gradle files yielded no results.