Question
Updated compileSdkVersion to 34 in React Native project, but unable to connect to Metro server
I recently updated my React Native project's compileSdkVersion from 33 to 34 to comply with Google's new policy. After making this change, I am unable to connect to the Metro server. Here are the details of my android/app/build.gradle configuration:
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 28
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.0.8775105"
}
android {
compileSdkVersion = 34
defaultConfig {
minSdkVersion = 28
targetSdkVersion = 34
}
}
My project setup includes:
- React version: 18.2.0
- React Native version: 0.72.3
Steps I've taken so far:
- Updated compileSdkVersion and targetSdkVersion to 34 in android/app/build.gradle.
- Cleaned the project using ./gradlew clean.
- Reinstalled node modules
rm -rf node_modules && npm install or yarn install
- Rebuilt the project with
npx react-native run-android
- Started the Metro server manually using
npx react-native start
Despite these steps, the Metro server fails to connect when running the app. I have also verified that all my dependencies are up to date.
3 165
3