Expo reload not working on Linux (with Android dev

2019-08-02 09:47发布

问题:

I'm having a problem with my expo app. It repently doesn't take my changes. Live reload, Hot reload doesn't work, and when I shake my device and press "reload", my app reload, but the changes doesn't appear.

What I already did:

  • reinstall watchman
  • delete node_modules and package-lock.json, and run $ npm install
  • clone and rebuild my project in other place
  • update expo-cli and expo-android-app

[I'm using elementary os (linux), expo-cli and android device]

Did something similar happen to someone? How did you resolve it?

my project dependencies:

"dependencies": { "@expo/samples": "2.1.1", "@expo/vector-icons": "^6.3.1", "expo": "^25.0.0", "firebase": "^4.12.1", "native-base": "^2.3.10", "react": "16.2.0", "react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz", "react-navigation": "^1.0.0-beta.27"

回答1:

"magically resolved" deleting node_modules folder and running $ npm install (AGAIN) and running... (?)



回答2:

I experienced the same problem .I noted that I had switched my app from development to production then back to development .

The problem is that cache was still working on production when I switched to development in the last step .

The log in my console was :

Running application "main" with appParams: {"initialProps":{"exp":{"initialUri":"exp://192.168.43.89:19000","manifest":{"iconUrl":"http://192.168.43.89:19001/assets/./assets/icon.png","isVerified":true,"hostUri":"192.168.43.89:19000","version":"1.0.0","slug":"myapp","splash":{"resizeMode":"contain","backgroundColor":"#f7be13","image":"./assets/splash.png","imageUrl":"http://192.168.43.89:19001/assets/./assets/splash.png"},"logUrl":"http://192.168.43.89:19000/logs","privacy":"public","assetBundlePatterns":["**/*"],"primaryColor":"#023C69","android":{"versionCode":1,"package":"com.apppzzzz.myapp","config":{"googleMaps":{"apiKey":""},"googleSignIn":{"certificateHash":"STRING","apiKey":"STRING"}}},"orientation":"portrait","bundleUrl":"http://192.168.43.89:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=false&minify=true&hot=false&assetPlugin=E%3A%5Ccde%5CTutorial%5CReactNative%5Cmyapp_rnapp%5Cnode_modules%5Cexpo%5Ctools%5ChashAssetFiles.js","updates":{"fallbackToCacheTimeout":0},"ios":{"supportsTablet":true},"packagerOpts":{"dev":false,"lanType":"ip","hostType":"lan","minify":true,"urlRandomness":"ha-wky"},"sdkVersion":"32.0.0","mainModuleName":"node_modules/expo/AppEntry","xde":true,"id":"@anonymous/myapp-dec62901-f76d-419c-8e72-76f2c0e279d7","androidStatusBar":{"backgroundColor":"#f7be10"},"debuggerHost":"192.168.43.89:19001","platforms":["ios","android"],"env":{},"icon":"./assets/icon.png","loadedFromCache":true,"developer":{"tool":"expo-cli","projectRoot":"E:\\cde\\Tutorial\\ReactNative\\myapp_rnapp"},"name":"myapp"},"shell":false}},"rootTag":1}
. __DEV__ === false, development-level warning are OFF, performance optimizations are ON

Take note of the __DEV__ === false

So I cleared cache in the console using SHIFT+R Then went to my phone and cleared Expo app`s cache

Then restarted my development server , and everything flowed fine !

The log __DEV__ === false changed to __DEV__ === true , and expo-reloading problems went away !



回答3:

Something similar to this happened to me while running expo on a windows machine and an iPhone 6S. I was able to get it to "reload" the code by creating an empty expo folder (expo init ReloadProject), going into and restarting the expo client there (expo start).

After accessing it with my phone (and seeing the default app message), and going back into my original project I was able to start expo again with the newer version of the code and see it on the phone working properly.

Aside from this, I also tried reverting code changes, removing node_modules and re-installing, restarting the computer and app on phone, manually clicking reload, trying hot reload and live reload but none of those approaches worked.



回答4:

I have solved my issue by connecting my Windows laptop to wifi (same as Android device) instead of wired connection.

Despite the fact that wifi and wired network are on the same LAN an everything else worked well.