Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeError: Cannot read property 'getCurrentPosition' of null] #433

Open
iamswarnkar opened this issue Feb 13, 2024 · 8 comments
Open

[TypeError: Cannot read property 'getCurrentPosition' of null] #433

iamswarnkar opened this issue Feb 13, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@iamswarnkar
Copy link

Environment

Run npx react-native info in your terminal and copy the results here.
`$ npx react-native info
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.22000
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Memory: 1.40 GB / 7.92 GB
Binaries:
Node:
version: 20.10.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.21
path: ~\AppData\Roaming\npm\yarn.CMD
npm:
version: 9.2.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "31"
- "33"
- "33"
- "34"
Build Tools:
- 30.0.3
- 31.0.0
- 33.0.1
- 34.0.0
System Images:
- android-31 | Intel x86 Atom_64
- android-31 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-231.9392.1.2311.11076708
Visual Studio: Not Found
Languages:
Java:
version: 17.0.9
path: C:\Program Files\Microsoft\jdk-17.0.9.8-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.4
wanted: 0.73.4
react-native-windows: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

`

Platforms

Is this issue related to Android, iOS, or both ?

##Android

Versions

Please add the used versions/branches

  • Android: 13
  • iOS:
  • react-native-geolocation-service:5.3.1
  • react-native: 0.73.4
  • react:18.2.0

Description

Please provide a clear and concise description of what the bug is. Include screenshots if needed.

Reproducible Demo

Provide a detailed list of steps that reproduce the issue.

Expected Results

Describe what you expected to happen.
image

@iamswarnkar iamswarnkar added the bug Something isn't working label Feb 13, 2024
@EmmanuelKeifala
Copy link

I am also facing this issue on version. 5.3.1

@neemanwa
Copy link

I'm too facing this issue after updating react-native-maps (https://developers.google.com/maps/documentation/android-sdk/renderer) under that com.google.android.gms:play-services-maps to 18.2.0.
And under react-native-geolocation-service def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "18.0.0"
There is mismatch of play service version and that might be the reason of crash

@GunnarAK
Copy link

This is fixed in PR #399

@phaniankur
Copy link

phaniankur commented May 25, 2024

So what is the work around here? Because PR #399 is not yet merged and released.

"react": "18.2.0",
"react-native": "0.74.1",
"react-native-geolocation-service": "5.3.1"

Recently updated to the latest react-native version and finding this error when location is accepted.
image

@xXDeathAbyssXx
Copy link

So what is the work around here? Because PR #399 is not yet merged and released.

"react": "18.2.0",
"react-native": "0.74.1",
"react-native-geolocation-service": "5.3.1"

Recently updated to the latest react-native version and finding this error when location is accepted. image

+1

@Kishan0904
Copy link

So what is the work around here? Because PR #399 is not yet merged and released.

"react": "18.2.0",
"react-native": "0.74.1",
"react-native-geolocation-service": "5.3.1"

Recently updated to the latest react-native version and finding this error when location is accepted. image

+1

Add below lines in android/build.gradle

buildscript {
ext {
// .....
playServicesLocationVersion = "21.0.1" // add this
// .....
}
}

@SwhiteMHC
Copy link

This is not working for me. I have patched react-native-geolocation-service and include this line in my android/build/gradle:

Change #1:
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "21.0.1"

Change #2:
playServicesLocationVersion = "21.0.1"

I still receive the cannot read property of null

@Kishan0904
Copy link

This is not working for me. I have patched react-native-geolocation-service and include this line in my android/build/gradle:

Change #1: def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "21.0.1"

Change #2: playServicesLocationVersion = "21.0.1"

I still receive the cannot read property of null

Don't create patch for this. Just use below lines of code & check again.
In package.json
"react": "18.2.0",
"react-native": "0.73.1",
"react-native-geolocation-service": "^5.2.0",

In Android build.gradle not app build
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
playServicesLocationVersion = "21.0.1"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants