故障信息:
Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.
解决方法:
demo千辛万苦调成了,但是转换到正式项目中就出问题,版本没错,但我的项目是android 混合reactnative开发的,而且还是android为主,reactnative只是个别界面,启动没不用ReactApplication。后来看了下,主要问题原来出自CodePush,一开始new CodePush的时候没有带deploymentKey。demo的测试更新这么可没有值,deploymentKey一直都在js那边填写。
public class SearchClientInfoNativeActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler { private ReactRootView mReactRootView; private ReactInstanceManager mReactInstanceManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mReactRootView = new ReactRootView(this); CodePush codePush = new CodePush("OxC.....", getApplicationContext(), BuildConfig.DEBUG); mReactInstanceManager = ReactInstanceManager.builder() .setApplication(getApplication()) .setBundleAssetName("index.android.bundle") .setJSMainModulePath("index") .setJSBundleFile(codePush.getBundleUrl("index.android.bundle")) .addPackage(codePush) .addPackage(new MainReactPackage()) .addPackage(new SearchClientInfoPackage()) .setUseDeveloperSupport(BuildConfig.DEBUG) .setInitialLifecycleState(LifecycleState.RESUMED) .build(); // 注意这里的HelloWorld必须对应“index.android.js”中的 // “AppRegistry.registerComponent()”的第一个参数 mReactRootView.startReactApplication(mReactInstanceManager, "searchclient", null); setContentView(mReactRootView); } ... }