react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Error when building the android app

Open MRolandd opened this issue 4 years ago • 9 comments

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

  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

MRolandd avatar Jul 14 '20 11:07 MRolandd

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

himat avatar Jul 17 '20 23:07 himat

same issue +1

rakesh0r avatar Jul 25 '20 07:07 rakesh0r

Doing this step fixed the issue.

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

rakesh0r avatar Jul 25 '20 08:07 rakesh0r

Same issue +1

Mhd-Emad avatar Aug 14 '20 21:08 Mhd-Emad

Same issue +1

nopmengkoung avatar Oct 12 '20 08:10 nopmengkoung

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

valiaghaei avatar Nov 30 '20 13:11 valiaghaei

Doing this step fixed the issue.

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

This is working for me.

ankitpmi avatar Mar 23 '22 05:03 ankitpmi

Doing this step fixed the issue.

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

Not Working!

Isaachi1 avatar Aug 30 '22 16:08 Isaachi1

Doing this step fixed the issue.

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

This worked, thanks

midoalone avatar Jan 23 '23 09:01 midoalone