React-native codepush Update is invalid - A JS bundle file named "null" could not be found

故障信息:

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);
    }
...
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值