mauron85 / react-native-background-geolocation

Background and foreground geolocation plugin for React Native. Tracks user when app is running in background.
Apache License 2.0
1.34k stars 565 forks source link

Error when building the android app #500

Open MRolandd opened 4 years ago

MRolandd commented 4 years ago

Your Environment

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

  1. I created a blank react-native App
  2. Installed this npm package
  3. Ran npm run android which runs react-native run-android
  4. I got the errors above

Context

Debug logs

himat commented 4 years ago

Got the same error when running the postlink file. Did you fix it?

rakesh0r commented 4 years ago

same issue +1

rakesh0r commented 4 years ago

Doing this step fixed the issue.

Screen Shot 2020-07-25 at 1 40 58 PM
Mhd-Emad commented 4 years ago

Same issue +1

nopmengkoung commented 4 years ago

Same issue +1

valiaghaei commented 4 years ago

At Path android/app/build.gradle defaultConfig { multiDexEnabled true //Add this line }

ankitpmi commented 2 years ago

Doing this step fixed the issue.

Screen Shot 2020-07-25 at 1 40 58 PM

This is working for me.

Isaachi1 commented 2 years ago

Doing this step fixed the issue.

Screen Shot 2020-07-25 at 1 40 58 PM

Not Working!

midoalone commented 1 year ago

Doing this step fixed the issue.

Screen Shot 2020-07-25 at 1 40 58 PM

This worked, thanks