Hey,
when I'm trying to run app with react-native-cordova-plugin, it builds properly, but crashes instantly after run on tablet / emulator ("Unfortunately, has stopped.").
Android monitor in android studio throws that error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appname/com.appname.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.cordova.reactnative.CordovaPluginPackage.setSavedInstanceState(android.os.Bundle)' on a null object reference.
My MainActivity.java:
(...imports...)public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "appname";
}
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
cordovaPluginPackage = new CordovaPluginPackage(this)
);
}
private CordovaPluginPackage cordovaPluginPackage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
cordovaPluginPackage.setSavedInstanceState(savedInstanceState);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
cordovaPluginPackage.onActivityResult(requestCode, resultCode, intent);
}
}
I deleted the @override keyword from getPackages() because it didn't compile.
Hey, when I'm trying to run app with react-native-cordova-plugin, it builds properly, but crashes instantly after run on tablet / emulator ("Unfortunately, has stopped.").
Android monitor in android studio throws that error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appname/com.appname.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.cordova.reactnative.CordovaPluginPackage.setSavedInstanceState(android.os.Bundle)' on a null object reference
.My MainActivity.java:
(...imports...)
public class MainActivity extends ReactActivity {
}
I deleted the @override keyword from getPackages() because it didn't compile.