Skip to content

Instantly share code, notes, and snippets.

@zetavg
Last active April 20, 2025 13:22
Show Gist options
  • Save zetavg/93adf1ac8e0ec881ab65cf7f7fa2fbd4 to your computer and use it in GitHub Desktop.
Save zetavg/93adf1ac8e0ec881ab65cf7f7fa2fbd4 to your computer and use it in GitHub Desktop.

Error Messages

> 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

How to Fix

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment