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

Android is not building

Open brunogonncalves opened this issue 4 years ago • 6 comments

Your Environment

  • Plugin version: ^0.6.3
  • Platform: Android
  • Running in Simulator: YES
  • React Native version: 0.62.2

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

brunogonncalves avatar Jul 16 '20 13:07 brunogonncalves

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?

JacobJaffe avatar Jul 17 '20 01:07 JacobJaffe

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.

brunogonncalves avatar Jul 29 '20 19:07 brunogonncalves

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.

Faustrox avatar Sep 02 '20 15:09 Faustrox

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

saumya1021 avatar Sep 21 '20 11:09 saumya1021

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

darron1217 avatar Jan 08 '21 03:01 darron1217

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

Lucksmith369 avatar Apr 17 '21 11:04 Lucksmith369