myreact= (LinearLayout) findViewById(R.id.myReact);//原生布局中的view mReactRootView = new ReactRootView((Activity)context); mReactInstanceManager = ReactInstanceManager.builder() .setApplication(((Activity) mContext).getApplication()) .setJSBundleFile(bundleFile)//设置加载文件,, 本地放一份文件。。本地实现缓存。拉接口更新此文件 .setNativeModuleCallExceptionHandler(new NativeModuleCallExceptionHandler() { @Override public void handleException(Exception e) { } }) .addPackage(new TBRnPackage()) .addPackage(new ReactImagePackage()) .setUseDeveloperSupport(false) .setInitialLifecycleState(LifecycleState.RESUMED) .build(); mReactRootView.startReactApplication(mReactInstanceManager,"BZMHA",null);//启动入口 myreact.addView(mReactRootView);//添加react布局