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.33k stars 561 forks source link

Android is not building #503

Open brunogonncalves opened 4 years ago

brunogonncalves commented 4 years ago

Your Environment

Context

The project is not building for android

Expected Behavior

Should build correctly and generate a .apk and .aab files.

Actual Behavior

Receiving a log error when try to build app:

The option 'android.enableUnitTestBinaryResources' is deprecated.
The current default is 'false'.
It has been removed from the current version of the Android Gradle plugin.
The raw resource for unit test functionality is removed.
Affected Modules: @mauron85_react-native-background-geolocation-common

Possible Fix

I did many tests and I saw is just needed to remove android.enableUnitTestBinaryResources from gradle.properties

Steps to Reproduce

  1. Open AndroidStudio
  2. Try to build app
JacobJaffe commented 4 years ago

This is also occurring for me. @brunogonncalves can yoou elaborate your fix? I'm seeing that error but have not found android.enableUnitTestBinaryResources

EDIT: Can confirm changing node_modules/@mauron85/react-native-background-geolocation/android/common/gradle.properties fixes the build issue. It's unclear to me if this will break functionality?

brunogonncalves commented 4 years ago

This is also occurring for me. @brunogonncalves can yoou elaborate your fix? I'm seeing that error but have not found android.enableUnitTestBinaryResources

EDIT: Can confirm changing node_modules/@mauron85/react-native-background-geolocation/android/common/gradle.properties fixes the build issue. It's unclear to me if this will break functionality?

For me worked without break any thing, just remove android.enableUnitTestBinaryResources line from file node_modules/@mauron85/react-native-background-geolocation/android/common/gradle.properties

I put in my project an .sh file to automatically remove this from the code to help my co-workers.

Faustrox commented 4 years ago

I fixed it without changing the package's files... I changed the build gradle version from 4.0.1 to 3.4.3 in android/build.gradle and it worked.

saumya1021 commented 3 years ago

Just add this to settings.gradle file 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')

darron1217 commented 3 years ago

I created fork to solve this issue. https://github.com/darron1217/react-native-background-geolocation

You can install it by command below

npm install https://github.com/darron1217/react-native-background-geolocation#develop
Lucksmith369 commented 3 years ago

Just add this to settings.gradle file 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')

Solves this problem

Here is it in a better format:

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')