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

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

About this issue

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

Commits related to this issue

Most upvoted comments

i updated my expo version to 20.1.2 and its work…

@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.

So I think this is a bug with the initial bundle that is preloaded into the app. After installing the APK, with my android device not connected to the internet I got the same error launching the app. When I connected to the wifi and relaunched the app, it started fine. Subsequent launches while offline worked fine too.