Version upgrade, found that the old version of the hot update can not be used, originally the underlying code changed
Private voidonjsbundleloadedfromserver (file file) {if(File = =NULL|| !file.exists ()) {Toast.maketext ( This, "No File", Toast.length_short). Show (); return; } //Toast.maketext (This, "Downloading complete", toast.length_short). Show (); Try { //JSCConfig.EMPTY.getConfigMap ();Hybriddata hb=NewHybriddata (); Reactapplication Application= (reactapplication) This; Class<?> Rimanagerclazz =application.getreactnativehost (). Getreactinstancemanager (). GetClass (); Method Method= Rimanagerclazz.getdeclaredmethod ("Recreatereactcontextinbackground", Javascriptexecutorfactory.class, Jsbundleloader.class); Method.setaccessible (true); Method.invoke (Application.getreactnativehost (). Getreactinstancemanager (),Newjscjavascriptexecutorfactory (), Jsbundleloader.createfileloader (File.getabsolutepath ())); } Catch(nosuchmethodexception e) {e.printstacktrace (); } Catch(Exception e) {e.printstacktrace (); } }
The idea of hot update is to download the Index.android.bundle, then get the path, pass the file path into the function, and then call
Recreatereactcontextinbackground This method to rebind the bundle file
React native 0.49 Android version hot update