I am getting this error:
Task :@react-native-community_async-storage:compileReleaseJavaWithJavac FAILED
/Users/Desktop/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java:10: error: package javax.annotation does not exist
import javax.annotation.Nullable; ^
/Users/Desktop/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java:20: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.ReadableArray;
like 1`
Why is this happening and how can I fix it?
OP's solution migrated from the question to an answer:
In your android/build.gradle, add the following lines
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) allprojects { configurations.all { resolutionStrategy { force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION } } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With