question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

undefined is not an object (evaluating m.getExponentPushTokenAsync) running Android Standalone APK

See original GitHub issue

Hi,

My app works nicely running in the exponent client, but the android apk fails at launch with the following error:

undefined is not an object (evaluating m.getExponentPushTokenAsync)

I bootstrapped initially using CRNA, but have modified to look a little more like an Expo project (maybe I’ve missed something!)

My app.json looks like this:

{
  "expo": {
    "name": "Switch",
    "version": "1.0.0",
    "sdkVersion": "18.0.0",
    "orientation": "portrait",
    "icon": "./assets/switch_icon.png",
    "slug": "switch",
    "privacy": "unlisted",
    "primaryColor": "#000000",
    "ios": {
      "bundleIdentifier": "com.switchapp.switch"
    },
    "android": {
      "package": "com.switchapp.switch"
    }
  }
}

And my package.json looks like so:

{
  "name": "switch",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "0.0.40",
    "jest-expo": "~18.0.0",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "aws-sdk": "^2.82.0",
    "babili": "^0.1.4",
    "base-64": "^0.1.0",
    "base64-arraybuffer": "^0.1.5",
    "blob-to-buffer": "^1.2.6",
    "buffer": "^5.0.6",
    "expo": "^18.0.3",
    "gnirts": "^1.1.1",
    "js-base64": "^2.1.9",
    "jwt-decode": "^2.2.0",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-18.0.3.tar.gz",
    "react-navigation": "^1.0.0-beta.11",
    "react-navigation-is-focused-hoc": "^1.0.0",
    "utf8": "^2.1.2"
  }
}

Thanks, Jack

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
derakhshanfarcommented, Sep 4, 2017

i updated my expo version to 20.1.2 and its work…

1reaction
GrigoryPtashkocommented, Aug 31, 2017

@dikaiosune, I’ve got the same issue with sdk 20 on android too. I’ve cleaned all the cache I don’t explicitly use getExponentPushTokenAsync and still get the error:

screenshot 2017-08-31 15 19 19

One thing worth mentioning is that I ejected the project but then converted back. Here are my exp.json and package.json.

{
  "name": "Hashnews",
  "description": "The news selection service",
  "slug": "hashnews",
  "privacy": "unlisted",
  "sdkVersion": "20.0.0",
  "version": "0.4.1",
  "orientation": "portrait",
  "primaryColor": "#cccccc",
  "icon": "./assets/icons/app-icon.png",
  "notification": {
    "icon": "./assets/icons/notification-icon.png",
    "color": "#000000"
  },
  "loading": {
    "icon": "./assets/icons/loading-icon.png",
    "hideExponentText": true
  },
  "packagerOpts": {
    "assetExts": [
      "ttf"
    ]
  },
  "ios": {
    "supportsTablet": true,
    "bundleIdentifier": "me.hashnews"
  },
  "android": {
    "package": "me.hashnews"
  }
}
{
  "name": "hashnews",
  "version": "0.0.0",
  "description": "Hello Expo!",
  "author": null,
  "main": "src/main.js",
  "scripts": {
    "test": "node node_modules/jest/bin/jest.js",
    "lint": "eslint .",
    "devtools": "react-devtools",
    "relay": "relay-compiler --src ./src --schema ./schema.json"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/samples": "~1.0.3",
    "@expo/vector-icons": "~5.0.0",
    "antd-mobile": "^1.6.2",
    "base-64": "^0.1.0",
    "expo": "^20.0.0",
    "hoist-non-react-statics": "^2.2.0",
    "lodash.isequal": "^4.4.0",
    "moment": "^2.17.1",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-20.0.0.tar.gz",
    "react-native-style-tachyons": "^3.4.2",
    "react-native-swipeout": "^2.0.13",
    "react-navigation": "^1.0.0-beta.12",
    "react-relay": "^1.2.0",
    "sockjs-client": "^1.1.4",
    "stompjs": "file:../stomp-websocket"
  },
  "devDependencies": {
    "babel-cli": "^6.18.0",
    "babel-core": "^6.21.0",
    "babel-eslint": "^7.1.1",
    "babel-plugin-idx": "^1.5.1",
    "babel-plugin-import": "^1.3.1",
    "babel-plugin-relay": "^1.2.0",
    "eslint": "^4.3.0",
    "eslint-plugin-react": "^7.1.0",
    "flow-bin": "^0.51.0",
    "graphql": "^0.10.5",
    "graphql-relay": "^0.5.2",
    "idx": "^1.5.0",
    "jest-expo": "~20.0.0",
    "prop-types": "^15.5.8",
    "react-devtools": "^2.5.0",
    "relay-compiler": "^1.2.0",
    "sync-request": "^4.0.1"
  },
  "eslintConfig": {
    "env": {
      "browser": true,
      "jest": true
    },
    "parser": "babel-eslint",
    "plugins": [
      "react"
    ],
    "extends": [
      "eslint:recommended",
      "plugin:react/recommended"
    ],
    "rules": {
      "max-len": [
        2,
        120,
        2
      ]
    }
  }
}

What should I do about it? It really is a stopper since I cannot get inside my app on android.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SDK 44]Expo application throws TypeError: undefined is not ...
I got this issue after upgrading to the latest Expo SDK 44 the android app didn't open with an error ...
Read more >
a module failed to load due to an error and appregistry ...
how to solve TypeError: undefined is not an object (evaluating '_reactNative.Text. ... EAS Build (Android) .apk Crashes, Expo Build .apk Runs Correctly.
Read more >
iOS error application on load | OutSystems
The Android apk works fine only iOS having this issue. ... undefined is not an object (evaluating 'e["default"]'). OutsystemsError.JPG.
Read more >
react-native-sound/Help - Gitter
i have a problem when install react-native sound to my project, when i import Sound and run project, it throw error: "undefined is...
Read more >
null is not an object (evaluating 'RNPurchases ...
Like Marcos mentioned, you'll have to make sure create a development build. This can be done either through EAS or with Xcode /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found