Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React native multiple bundle in Android #22363

Closed
lws869 opened this issue Nov 21, 2018 · 1 comment
Closed

React native multiple bundle in Android #22363

lws869 opened this issue Nov 21, 2018 · 1 comment
Labels
Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@lws869
Copy link

lws869 commented Nov 21, 2018

I have another RN project and generate it as a bundle (named: appA.bundle) with the app.js registered component "ProjectA".

In my main RN project or say framework project (bundle name: index.bundle) with the app.js registered component "MainProject", i would like to call the appA.bundle. However, it doesnt work. Would anyone please advise?

Many thanks.

The following coding is used to call the bundle in Android Studio.

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

 mReactRootView = new ReactRootView(this);
 mReactInstanceManager = ReactInstanceManager.builder()
         .setApplication(getApplication())
         .setBundleAssetName("appA.bundle")
         .setJSMainModulePath("index")
         .addPackage(new MainReactPackage())
         .setUseDeveloperSupport(BuildConfig.DEBUG)
         .setInitialLifecycleState(LifecycleState.RESUMED)
         .build();
         
 mReactRootView.startReactApplication(mReactInstanceManager, "ProjectA", null);

 setContentView(mReactRootView);
}

The following error show in Android Studio logcat:

10-31 15:25:27.890 24965-28439/com.mainproject I/ReactNativeJS: Running application "ProjectA" with appParams: {"rootTag":51}. DEV === true, development-level warning are ON, performance optimizations are OFF

10-31 15:25:27.891 24965-28439/com.mainproject E/ReactNativeJS: Application ProjectA has not been registered.

Hint: This error often happens when you're running the packager (local dev server) from a wrong folder. For example you have multiple apps and the packager is still running for the app you were working on before.

If this is the case, simply kill the old packager instance (e.g. close the packager terminal window) and start the packager in the correct app folder (e.g. cd into app folder and run 'npm start').

This error can also happen due to a require() error during initialization or failure to call AppRegistry.registerComponent.

10-31 15:25:27.897 24965-24965/com.vendorproject E/unknown:ReactNative: Unable to launch redbox because react activity is not available, here is the error that redbox would've displayed: Application ProjectA has not been registered.

@react-native-bot react-native-bot added Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. Platform: Android Android applications. labels Nov 21, 2018
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. 📋No Template labels Nov 21, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Nov 21, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

2 participants