【问题标题】:React Native Android : index.android.bundle not updating on code changeReact Native Android:index.android.bundle 未在代码更改时更新
【发布时间】:2021-06-14 00:34:17
【问题描述】:

我在 react-native 和 Android Studio 上遇到了一个新问题,当我对文件进行更改时,应用代码没有更新。

我需要运行'react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle -- assets-dest android/app/src/main/res/' 然后在 Android Studio 上再次运行应用程序,以便应用程序具有最新更改。

热重载在 IOS 模拟器上运行良好,但在 Android 模拟器上运行良好。

我在 Mac OS 11 和 M1 模拟器预览版 (https://github.com/google/android-emulator-m1-preview) 上运行。

知道如何解决这个问题吗?

提前致谢, 朱利安

【问题讨论】:

    标签: android react-native android-studio


    【解决方案1】:

    我遇到了同样的问题,我找到了这个解决方案,它对我有用。

    打开android/app/src/main/java/{packagename}目录下的MainApplication.java,如果存在则删除以下代码

    import com.facebook.react.BuildConfig;
    

    改变这个方法,

    public boolean getUseDeveloperSupport() {
       // return BuildConfig.DEBUG;
       return true;
    }
    

    希望对你有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-26
      • 1970-01-01
      • 1970-01-01
      • 2021-10-28
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 2017-12-24
      相关资源
      最近更新 更多