> Task :app:compileReleaseKotlin FAILED
e: file:///.../android/app/src/main/java/.../MainActivity.kt:11:8 Unresolved reference: expo
e: file:///.../android/app/src/main/java/.../MainActivity.kt:33:12 Unresolved reference: ReactActivityDelegateWrapper
e: file:///.../android/app/src/main/java/.../MainApplication.kt:16:8 Unresolved reference: expo
e: file:///.../android/app/src/main/java/.../MainApplication.kt:17:8 Unresolved reference: expo
e: file:///.../android/app/src/main/java/.../MainApplication.kt:21:51 Unresolved reference: ReactNativeHostWrapper
e: file:///.../android/app/src/main/java/.../MainApplication.kt:41:13 Unresolved reference: ReactNativeHostWrapper
e: file:///.../android/app/src/main/java/.../MainApplication.kt:50:5 Unresolved reference: ApplicationLifecycleDispatcher
e: file:///.../android/app/src/main/java/.../MainApplication.kt:55:5 Unresolved reference: ApplicationLifecycleDispatcher
Open the Android project in Android Studio, open app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList
and use the editor to auto-fix the errors.
Or add the dependencies manually in android/app/build.gradle
(without the need of Android Studio):
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
// Add things like these!
implementation project(':expo')
implementation project(':react-native-reanimated')
implementation project(':react-native-safe-area-context')
implementation project(':react-native-screens')
implementation project(':react-native-svg')
Tip
The following command can produce the list of deps that should be added as implementation project(':<dep>')
:
node_modules/.bin/react-native config | jq '.dependencies[].name'
Thanks to @zoriya for this info!