Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28463

com.facebook.react.bridge.WritableMap.copy() on a null object reference

$
0
0

I have a background service on my app wrote with react-native. When start service then closed app and alert: "Stoped: Unfortunately". I open project on android studio for test and debug. and i take it problem.

My react-native version: 0.0.1 and my package json like that;


{
  "name": "kimdeyizApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "lint": "eslint",
    "postinstall": "npx jetify"
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-axios": "^0.17.1",
    "react-native-elements": "^1.2.6",
    "react-native-push-notification": "^3.1.9",
    "react-native-router-flux": "^4.0.6",
    "react-redux": "^7.0.3",
    "redux": "^4.0.1",
    "redux-actions": "^2.6.5",
    "socket.io-client": "^2.3.0",
    "watchman": "^1.0.0"
  },
  "devDependencies": {
    "@babel/core": "7.6.4",
    "@babel/runtime": "7.6.3",
    "@react-native-community/eslint-config": "0.0.3",
    "babel-jest": "24.9.0",
    "eslint": "6.5.1",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-import": "^2.17.2",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-react": "^7.13.0",
    "jest": "24.9.0",
    "jetifier": "^1.6.4",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

HeadlessJsTaskConfig.java

package com.facebook.react.jstasks;
import com.facebook.react.bridge.WritableMap;
public class HeadlessJsTaskConfig {
  private final String mTaskKey;
  private final WritableMap mData;
  private final long mTimeout;
  private final boolean mAllowedInForeground;
  private final HeadlessJsTaskRetryPolicy mRetryPolicy;
  public HeadlessJsTaskConfig(String taskKey, WritableMap data) {
    this(taskKey, data, 0, false);
  }
  public HeadlessJsTaskConfig(String taskKey, WritableMap data, long timeout){
    this(taskKey, data, timeout, false);
  }
  public HeadlessJsTaskConfig(
      String taskKey, WritableMap data, long timeout, boolean allowedInForeground) {
    this(taskKey, data, timeout, allowedInForeground, NoRetryPolicy.INSTANCE);
  }
  public HeadlessJsTaskConfig(
      String taskKey,
      WritableMap data,
      long timeout,
      boolean allowedInForeground,
      HeadlessJsTaskRetryPolicy retryPolicy) {
    mTaskKey = taskKey;
    mData = data;
    mTimeout = timeout;
    mAllowedInForeground = allowedInForeground;
    mRetryPolicy = retryPolicy;
  }

  public HeadlessJsTaskConfig(HeadlessJsTaskConfig source) {
    mTaskKey = source.mTaskKey;
    mData = source.mData.copy();
    mTimeout = source.mTimeout;
    mAllowedInForeground = source.mAllowedInForeground;

    final HeadlessJsTaskRetryPolicy retryPolicy = source.mRetryPolicy;
    if (retryPolicy != null) {
      mRetryPolicy = retryPolicy.copy();
    } else {
      mRetryPolicy = null;
    }
  }

  String getTaskKey() {
    return mTaskKey;
  }

  WritableMap getData() {
    return mData;
  }

  long getTimeout() {
    return mTimeout;
  }

  boolean isAllowedInForeground() {
    return mAllowedInForeground;
  }

   HeadlessJsTaskRetryPolicy getRetryPolicy() {
    return mRetryPolicy;
  }

}

and my error;

  --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.kimdeyizapp, PID: 8514
    java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.bridge.WritableMap com.facebook.react.bridge.WritableMap.copy()' on a null object reference
        at com.facebook.react.jstasks.HeadlessJsTaskConfig.<init>(HeadlessJsTaskConfig.java:88)
        at com.facebook.react.jstasks.HeadlessJsTaskContext.startTask(HeadlessJsTaskContext.java:106)
        at com.facebook.react.jstasks.HeadlessJsTaskContext.startTask(HeadlessJsTaskContext.java:84)
        at com.facebook.react.HeadlessJsTaskService$2.run(HeadlessJsTaskService.java:123)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 8514 SIG: 9
Process 8514 terminated.

So other a problem is like that.

E/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.kimdeyizapp/app_webview/variations_seed": /data/user/0/com.kimdeyizapp/app_webview/variations_seed (No such file or directory)

Thanks for helps.


Viewing all articles
Browse latest Browse all 28463

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>