Problems with detached Expo project on Android

I set up the very latest Expo project (version sdk 28), which I have now detached. I was able to run the sample app on ios fine using react-native run-ios whilst running exp start in a separate window.

On Android, it’s using a completely different URL and port 8081 when I run react-native run-android --variant DevDebug and doesn’t seem to use exp start server on port 19001.

Is this expected and is this how you run a detached project?

I’m also getting adb server version (32) doesn't match this client (40); killing.... Can anyone help? Sorry for stupid questions, I’m brand new to Expo and React Native.

Update: I discovered I can build and run in Android Studio and it uses the exp start server. Would love to know how to run this headless from command line as React-Native does something different.

So it turns out you can’t use react-native run-android although it seems to work for ios.

Way to run from npm or yarn command-line is using (replacing [packageId] with your own):

"scripts": {
    "android": "pushd android && ./gradlew installDevDebug --stacktrace && adb shell am start -n [packageId]/host.exp.exponent.LauncherActivity && popd",
      ...
 }

Then you can:

yarn run android
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.