gpt4 book ai didi

android - react native : Emulator stuck on "loading from localhost:8081.."

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:14:20 28 4
gpt4 key购买 nike

Screenshot from Android phone running the app

我正在开发一个 react-native 项目,我通过 USB 调试和命令“react-native run android”在我的 android 手机上运行它。

一切正常,但现在即使构建成功,应用程序也会卡在白屏上“从 localhost:8081 加载”。未对任何应用文件进行任何更改。

我尝试运行 react-native 演示应用程序(使用 react-native init),但我仍然面临同样的问题。

我试过的解决方案还是一样的问题:

  1. rm -rf node_modules && npm install
  2. adb 反向 tcp:8081 tcp:8081
  3. 在 Android Studio 的 Android Emulator 上运行它。
  4. 使用命令npm run android

这是命令行中显示的内容:

lenovo@lenovo-Lenovo-ideapad-500S-14ISK:~/IRMSold$ react-native run-android Scanning folders for symlinks in /home/lenovo/IRMSold/node_modules (6ms) JS server already running. Building and installing the app on the device (cd android && ./gradlew installDebug)...

Configure project :app WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configure project :react-native-google-signin WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (23.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.1. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove "buildToolsVersion '23.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Configure project :react-native-vector-icons WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.1. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Task :app:installDebug Installing APK 'app-debug.apk' on 'Lenovo X3a40 - 6.0.1' for app:debug Installed on 1 device.

BUILD SUCCESSFUL in 13s 66 actionable tasks: 1 executed, 65 up-to-date Running adb -s 567bf688 reverse tcp:8081 tcp:8081 Starting the app on 567bf688 (adb -s 567bf688 shell am start -n com.irms/com.irms.MainActivity)... Starting: Intent { cmp=com.irms/.MainActivity }

请帮我解决问题,因为我尝试了所有可以在网上找到的其他修复方法。

最佳答案

在我的例子中,问题是由于文件句柄限制。有一次,我通过以下命令刷新限制,应用程序开始运行没有任何问题。

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server

我正在使用 Ubuntu 18.04。

关于android - react native : Emulator stuck on "loading from localhost:8081..",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50226232/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com