Go back to debugging after created release version with react-native bundle (Android)

别等时光非礼了梦想. 提交于 2019-12-09 19:18:01

问题


So I have created my Application using React native and just produced my first release-build. My problem now is that I can't get back to react natives debug-mode.

By following the documentation, this is what i did.

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/

This code generated the bundled index.android.bundle and index.android.bundle.meta

Now every time I execute react-native run-android, the javascript code-base wont update the application and I am not able to access the development(shake) menu in my app.

If I run react-native bundle again, the code will update.

I guess this is a simple issue, but can't find any information how to return so the app isn't using the bundled version anymore.


回答1:


  • Delete assets folder in app/src/main/
  • Remove this import line if exist : "import com.facebook.react.BuildConfig;" in MainApplication.java
  • Run "react-native run-android"

And boom!




回答2:


My quickest way is openning the file: $projectRoot\android\app\src\main\java\com\movies\MainApplication.java, going to the code like:

public boolean getUseDeveloperSupport() {
 return false; //it was changed to false from BuildConfig.DEBUG when released
}

then changing the false to true to make the debug menu available again.




回答3:


It happens with wrong import statement in MainApplication.java, You have to check if any statement like import com.facebook.react.BuildConfig; is in the imports. If so, remove that and run react-native run-android

No need to delete assets folder



来源:https://stackoverflow.com/questions/46276722/go-back-to-debugging-after-created-release-version-with-react-native-bundle-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!