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

FAILURE: Build completed with 2 failures. after installation of module #563

Open EmanueleAgo opened 2 years ago

EmanueleAgo commented 2 years ago

Your Environment

Context

I want to install the module but I have 2 error when I run android after installation.

Expected Behavior

Actual Behavior

Possible Fix

Steps to Reproduce

  1. yarn add @mauron85/react-native-background-geolocation
  2. node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
  3. addgooglePlayServicesVersion = "17.6.0" in ext of android/build.gradle
  4. npm run android

Context

I tryed the manual setup but there are some errors similar to this.

Debug logs

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script 'C:\Users\emanu\App\DetectApp-copia11\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'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle

* 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 10s
zero2603 commented 2 years ago

Same issue

DanDance commented 2 years ago

https://github.com/mauron85/react-native-background-geolocation/issues/500#issuecomment-663829795

enriqueFcoG commented 2 years ago

add this to your android/settings.gradle

include ':@mauron85_react-native-background-geolocation-common'
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common')
include ':@mauron85_react-native-background-geolocation'
project(':@mauron85_react-native-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/lib')