[@nativescript/geolocation] - Error: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
See original GitHub issueThe following exception is being thrown whenever I call the enableLocationRequest()
method.
Error: Uncaught (in promise): Error: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
JS: _systemDialogWillShow(file:///data/user/0/<directory>/files/app/vendor.js:145569:61)
JS: at (file:///data/user/0/<directory>/files/app/vendor.js:145468:14)
JS: at ZoneAwarePromise(file:///data/user/0/<directory>/files/app/vendor.js:146586:29)
JS: at enableLocationRequest(file:///data/user/0/<directory>/files/app/vendor.js:145465:12)
JS: at (file:///data/user/0/<directory>/files/app/bundle.js:441:79)
JS: at ZoneDelegate.invoke(file:///data/user/0/<directory>/files/app/vendor.js:146072:26)
JS: at onInvoke(file:///data/user/0/<directory>/files/app/vendor.js:73479:33)
JS: at ZoneDelegate.invoke(file:///data/user/0/<directory>/files/app/vendor.js:146071:32)
JS: at...
In the ngOnInit of my component, I’m calling the following piece of code
import { enableLocationRequest, isEnabled } from '@nativescript/geolocation';
...
isEnabled().then((enabled: boolean) => {
if (!enabled) {
return enableLocationRequest(true, true);
}
});
This is happening on Android 11. Below are my gradle files and the permissions I have in the AndroidManifest.xml
android {
defaultConfig {
minSdkVersion 22
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Am I missing something? This is happening every time that method is called, and according to the docs that’s all that is required to request location. Thanks in advance.
Package.json include the following versions
"@angular/animations": "~11.2.7",
"@angular/cdk": "10.2.5",
"@angular/common": "~11.2.7",
"@angular/compiler": "~11.2.7",
"@angular/core": "~11.2.7",
"@angular/forms": "~11.2.7",
"@angular/material": "10.2.5",
"@angular/platform-browser": "~11.2.7",
"@angular/platform-browser-dynamic": "~11.2.7",
"@angular/router": "~11.2.7",
"@nativescript/angular": "~11.8.0",
"@nativescript/core": "~8.0.0",
"@nativescript/geolocation": "7.2.1",
"@nativescript/theme": "3.0.0",
"nativescript-permissions": "1.3.11",
"reflect-metadata": "0.1.13",
"rxjs": "~6.6.7",
"tslib": "2.0.3",
"zone.js": "~0.11.1"
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
NullPointerException: Attempt to invoke virtual method ...
NullPointerException : Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference ...
Read more >Attempt to invoke virtual method 'boolean java.lang ... - YouTube
Android : NullPointerException : Attempt to invoke virtual method ' boolean java. lang. String.equalsIgnoreCase( java. lang. String )' on a null ...
Read more >Attempt to invoke virtual method 'boolean java.lang.String ...
NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference #183.
Read more >Attempt to invoke virtual method ''boolean java.lang.String ...
NullPointerException : Attempt to invoke virtual method ''boolean java.lang.String.equals(java.lang.Object)'' on a null object reference at org.mozilla.gecko.
Read more >Attempt to invoke virtual method 'boolean java.lang.String ...
NullPointerException : Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@yencolon i have this error: JS: Error: java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean android.app.Activity.shouldShowRequestPermissionRationale(java.lang.String)’ on a null object reference
Upgraded the plugin to v8.0.1. But still throws the same error
Workaround: Checking if there is a foreground activity on Android, before requesting the location has cleared the error.