react-native-reanimated
                                
                                 react-native-reanimated copied to clipboard
                                
                                    react-native-reanimated copied to clipboard
                            
                            
                            
                        Cannot build react-native-reanimated version 2.8.0 with React Native 0.68.2 for android using M1 mac
Description
Cannot build react-native-reanimated version 2.8.0 with React Native 0.68.2 for android using M1 mac. Error on line 676 of react-native-reanimated build.gradle.
Expected behavior
Should successfully build the application. The only version I can successfully build is 2.2.0.
Actual behavior & steps to reproduce
Type and run the following command:
react-native run-android
Snack or minimal code example
> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/android/react-native-reanimated-67-hermes.aar
Native libs debug enabled: false
Android gradle plugin: 7.0.4
Gradle: 7.3.3
building Reanimated2
WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 executed
Note: /Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/android/build.gradle' line: 676
* What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.
> Expected directory '/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/node_modules/react-native/../jsc-android/dist/org/webkit/android-jsc' to contain exactly one file, however, it contains no files.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 58s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: /Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/android/build.gradle' line: 676
* What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.
> Expected directory '/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/node_modules/react-native/../jsc-android/dist/org/webkit/android-jsc' to contain exactly one file, however, it contains no files.
Package versions
| name | version | 
|---|---|
| react-native | 0.68.2 | 
| react-native-reanimated | 2.8.0 | 
| NodeJS | 16.14.2 | 
| Xcode | |
| Java | openjdk 11.0.15 (zulu 11) | 
| Gradle | 7.3.3 | 
| expo | N/A | 
Affected platforms
- [x] Android
- [ ] iOS
- [ ] Web
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem?
@only1chi  please check
fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" })
the above code found many aar files => error . You need change patten "//*.aar" to right . Ex "//*release.aar"
@only1chi please check
fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" })the above code found many aar files => error . You need change patten "//*.aar" to right . Ex "//*release.aar"
Thanks for responding. Just to be clear, you're asking me to change the line to:
fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*release.aar" })?
If so, I did make the recommended change and I got the same error. However, it is worth noting that there is no "android-jsc" folder inside of fileTree("$reactNative/../). The "$reactNative" variable evaluates to:
/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/node_modules/react-native
Going back one level provides a file tree as follows:
/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/react-native-reanimated/node_modules
There is no "jsc-android" folder within it.
The "jsc-android" folder only exists at the top level of the project, which is:
/Users/chizurokechikwendu/Desktop/Git_Repo/sts-torquefit-2/node_modules/jsc-android/dist/org/webkit/android-jsc
As it turns out, the change I needed to make is as a follows:
fileTree("$reactNative/../../../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*release.aar" })
I also noticed that the symlink in react-native-reanimated/android/src/main/Common does not exist when I add the package to my project.
As it turns out, I've now successfully built my project, however, I needed to make the following changes:
- Edit line 676 of react-natve-reanimated build.gradle as follows:
fileTree("$reactNative/../../../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*release.aar" })
- Manually create a symlink from react-native-reanimated/Commontoreact-native-reanimated/android/src/main/Common
Try  distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
Will this work
So after changing the gradle file to distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip, react-native-reanimated successfully builds with the original v2.8.0 version.
Thanks!
As it turns out, I've now successfully built my project, however, I needed to make the following changes:
- Edit line 676 of react-natve-reanimated build.gradle as follows:
fileTree("$reactNative/../../../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*release.aar" })- Manually create a symlink from
react-native-reanimated/Commontoreact-native-reanimated/android/src/main/Common
I am having a similar issue - but I don't have a line 676 or this filetree line in my build.gradle for react native reanimated. Maybe it is because I am not using the webkit distribution.