react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Error when building the android app
Your Environment
- Plugin version: ^0.6.3
- Platform: Android
- OS version: Android 10+
- Device manufacturer and model: Emulated Android Studio device Pixel 2
- Running in Simulator: Yes
- React Native version: ~0.62.2
- Plugin configuration options:
- Link to your project:
Context
After installing this package, when I run react-native run-android it gives me some errors
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script 'C:\react\geoloc-v3\node_modules\@mauron85\react-native-background-geolocation\android\common\VERSIONS.gradle' line: 27
* What went wrong:
A problem occurred evaluating project ':@mauron85_react-native-background-geolocation-common'.
> Could not get unknown property 'android' for project ':app' of type org.gradle.api.Project.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':@mauron85_react-native-background-geolocation-common'.
> compileSdkVersion is not specified.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Then I've seen something about app linking. So I've tried to run this:
node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
And it gave me this error:
PS C:\react\geoloc-v3> node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
internal/validators.js:112
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:112:11)
at Object.join (path.js:375:7)
at Object.<anonymous> (C:\react\geoloc-v3\node_modules\@mauron85\react-native-background-geolocation\scripts\postlink.js:28:30)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11 {
code: 'ERR_INVALID_ARG_TYPE'
}
Expected Behavior
I should be able to run the android app successfully
Actual Behavior
Possible Fix
Steps to Reproduce
- I created a blank react-native App
- Installed this npm package
- Ran npm run android which runs react-native run-android
- I got the errors above
Context
Debug logs
Got the same error when running the postlink file. Did you fix it?
same issue +1
Doing this step fixed the issue.

Same issue +1
Same issue +1
At Path android/app/build.gradle defaultConfig { multiDexEnabled true //Add this line }
Doing this step fixed the issue.
![]()
This is working for me.
Doing this step fixed the issue.
![]()
Not Working!
Doing this step fixed the issue.
![]()
This worked, thanks