File tree Expand file tree Collapse file tree
android/src/main/java/cn/reactnative/modules/update Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,7 +150,26 @@ public void run() {
150150 }
151151
152152 final Context application = mContext .getApplicationContext ();
153- JSBundleLoader loader = JSBundleLoader .createFileLoader (UpdateContext .getBundleUrl (application ));
153+ final Context application = mContext .getApplicationContext ();
154+ String updateBundlePath = updateContext .getBundleUrl (application );
155+
156+ JSBundleLoader loader ;
157+
158+ if (updateBundlePath != null ) {
159+ loader = JSBundleLoader .createFileLoader (updateBundlePath );
160+ } else {
161+ String bundleAssetName = "index.android.bundle" ;
162+ try {
163+ ReactInstanceManager defaultInstanceManager = ((ReactApplication ) application ).getReactNativeHost ().getReactInstanceManager ();
164+ String rnBundleAssetName = defaultInstanceManager .getBundleAssetName ();
165+ if (rnBundleAssetName != null && !rnBundleAssetName .isEmpty ()) {
166+ bundleAssetName = rnBundleAssetName ;
167+ }
168+ } catch (Exception e ) {
169+ Log .e (NAME , "Failed to get default asset name from ReactNativeHost: " + e .getMessage ());
170+ }
171+ loader = JSBundleLoader .createAssetLoader (application , bundleAssetName , false );
172+ }
154173 try {
155174 ReactInstanceManager instanceManager = updateContext .getCustomReactInstanceManager ();
156175
You can’t perform that action at this time.
0 commit comments