Skip to content

No such static method: 'com.facebook.react.ReactInstanceManagerBuilder com.facebook.react.ReactInstanceManager.builder ()' #22937

@kishangpt

Description

@kishangpt

Environment

React Native Environment Info:
System:
OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz
Memory: 149.66 MB / 11.65 GB
Shell: 4.3.48 - /bin/bash
Binaries:
Node: 11.6.0 - /usr/bin/node
Yarn: 1.12.3 - /usr/bin/yarn
npm: 6.5.0-next.0 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.0, 28.0.0, 28.0.1, 28.0.2, 28.0.3
npmPackages:
react: 16.6.3 => 16.6.3
react-native: ^0.57.8 => 0.57.8
npmGlobalPackages:
react-native-cli: 2.0.1

Description

I have an existing native application and I integrated react-native into it. I have added an activity as mentioned in http://facebook.github.io/react-native/docs/integration-with-existing-apps. But as soon as I launch this activity, I get an exception with stacktrace as below:

PID:19295 java.lang.NoSuchMethodError: No static method builder()Lcom/facebook/react/ReactInstanceManagerBuilder; in class Lcom/facebook/react/ReactInstanceManager; or its super classes (declaration of 'com.facebook.react.ReactInstanceManager' appears in /data/app/com...-rcet5Tnxiu0dRzX1LDQFIQ==/base.apk) //////////////////// Stack Trace //////////////////// at com.....*.presentation.view.activity.MyReactActivity.onCreate(MyReactActivity.java:21) at android.app.Activity.performCreate(Activity.java:7173) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2901) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3023) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1689) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6919) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1370)

Reproducible Demo

public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
private ReactRootView mReactRootView;
private ReactInstanceManager mReactInstanceManager;

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

    mReactRootView = new ReactRootView(this);
    mReactInstanceManager = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setBundleAssetName("index.android.bundle")
            .setJSMainModulePath("index")
            .addPackage(new MainReactPackage())
            .setUseDeveloperSupport(BuildConfig.DEBUG)
            .setInitialLifecycleState(LifecycleState.RESUMED)
            .build();
    // The string here (e.g. "MyReactNativeApp") has to match
    // the string in AppRegistry.registerComponent() in index.js
    mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);

    setContentView(mReactRootView);
}
.........

}

Its always reproducible as soon as MyReactActivity is launched.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions