Reputation: 995
Hi I recently created a react native app version 0.60.5 and installed react-navigation with react-native-reanimated. When I built the project in Android Studio, I'm getting this error in react-native-reanimated: Execution failed for task ':react-native-reanimated:compileDebugJavaWithJavac'
. Is there anything I did wrong?
Upvotes: 19
Views: 80163
Reputation: 1
That work for me
npm i [email protected] or Yarn add [email protected]
cd android && ./gradlew clean cd ../ npx react-native run-android
Upvotes: 0
Reputation: 549
If your build.gradle
looks like this :
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30 // or 31
targetSdkVersion = 30 // or 31
ndkVersion = "20.1.5948944"
}
modify inside package.json
remove ^
from react-native-reanimated
plugin as below,
Before,
"react-native-reanimated": "^2.9.1",
After,
"react-native-reanimated": "2.9.1",
then,
rm -rf node_modules // to delete mode_modules or you can delete in manually
then run,
npm i --force
which solved my issue.
Upvotes: 0
Reputation: 2037
I encountered a similar issue with React Native 0.72 and react-native-reanimated. I tried several suggested solutions, but none of them worked for me. Here's what finally resolved the problem:
First, I removed the existing react-native-reanimated package:
yarn remove react-native-reanimated
Then, I installed a specific version of react-native-reanimated:
yarn add [email protected]
After these steps, everything started working perfectly. I hope this helps anyone facing the same issue!
Upvotes: 3
Reputation: 27
Do This
rm -rf node_modules && yarn install && react-native run-android
Upvotes: 0
Reputation: 61
I was facing problem with reanimated library -
My problem was that my username on PC contains the '.'
Solution move your project inside 'C:\Users\youruser.name\projectName'
Then run commands to run application -- yarn npm start npm run android
Upvotes: 0
Reputation: 31
Force react-native-reanimated to use the version of root's react-native version by
allprojects {
repositories { /* ... */ }
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:0.63.4'
}
}
}
And also change the version of react-native-reanimated to 2.10.0
It worked for me.
NOTE : It should be a comment but I do not have enough reputation to do so.
Upvotes: 0
Reputation: 522
Add this to your android/build.gradle file
allprojects {
repositories { /* ... */ }
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:0.63.4'
}
}
}
When adding the code, make sure the react native version you have installed matches the version on this line: force 'com.facebook.react:react-native:0.63.4'
Upvotes: 2
Reputation: 31
I had also the same issue but i fixed it by updating react-native-reanimated version 2.10.0 to 2.12.0 Thank you
Upvotes: 2
Reputation: 2765
In my case the error was that I didn't have installed the correct version of buildToolsVersion
in the SDK Manager.
I have tried removing the library and running it again and then I saw that the minimum version requested for my project (due to some of the packages constraints) was 30 (R), so I had to upgrade the buildToolsVersion
to 30.0.3 and setup targetVersion
and compileversion
to 30 and then it worked.
for
"react-native-reanimated": "^2.9.1",
buildToolsVersion = "30.0.3" // must be updated
minSdkVersion = 29 //must be updated
compileSdkVersion = 30
targetSdkVersion = 30
Upvotes: 0
Reputation: 21
If you're getting this type of errors
Task :react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED react native
This worked for me:
Add this in android\build.gradle
In file check buildscript
buildToolsVersion = "29.0.2" must be updated
minSdkVersion = 16 as per your updated version change into 21
compileSdkVersion = 29
targetSdkVersion = 29
clear your gradle file
Delete the node_modules and install again.
npm i
npm run ios or
npm run android
Upvotes: 1
Reputation: 1
Add this to your gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
Upvotes: 0
Reputation: 10997
gradle.properties under android
android.useAndroidX=true
android.enableJetifier=true
run following command
npm install -g jetifier
npx jetify
Upvotes: 1
Reputation: 10858
Delete the node_modules and install again.
rm -rf node_modules && yarn install && react-native run-android
Upvotes: 1
Reputation: 456
This worked for me:
npm install -g jetifier
npx jetify
At root project. Thanks to Harsh2402 for his answer on this issue : https://github.com/kmagiera/react-native-gesture-handler/issues/642
Upvotes: 24