react-native-geolocation-service: TypeError: null is not an object (evaluating 'RNFusedLocation.startObserving')

    this.watchID = Geolocation.watchPosition(
      position => {
        console.log("New position!");
      error => console.log(error),
        enableHighAccuracy: true,
        timeout: 20000,
        distanceFilter: 0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 29 (7 by maintainers)

Most upvoted comments

i got same issue. fixed with add this lines to android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
    playServicesVersion = "18.0.0"
    playServicesLocationVersion = "21.0.1"

“react-native”: “0.61.5”, “react-native-geolocation-service”: “^4.0.0”, “react-native-maps”: “^0.26.1”

Check These lines added in your

import com.agontuk.RNFusedLocation.RNFusedLocationPackage;

add new RNFusedLocationPackage() in

@Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new MapsPackage(), new RNFusedLocationPackage()


It fixes my issue

It fixed for me after I did react-native run-android

Had similar issue and this saved me within 5mins [stackoverflow soluntion](

I also receive this with getcurrentPosition:

Geolocation.getCurrentPosition( (position) => { console.log(position); }, (error) => { // See error code charts below. console.log(error.code, error.message); }, { enableHighAccuracy: false, timeout: 15000, maximumAge: 10000 } ); These are the packages.

"react-native": "0.60.4",
"react-native-geolocation-service": "^3.0.0",

The error received is: ReactNativeJS ▶︎ Possible Unhandled Promise Rejection (id: 0): │ TypeError: null is not an object (evaluating ‘RNFusedLocation.getCurrentPosition’) │ getCurrentPosition$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:181123:32

Happy to provide more information as i’m at a bit of a loss on this now.

The solution I went with, which ended up being the easiest, was to just not use this at all. It has it’s pros and cons though.

@markwillis82 , can you look inside the node_modules/react-native-geolocation-service and upload the contents of js/index.js and inside android folder to pastebin or similar site ?

Also make sure you added new RNFusedLocationPackage() in