React-native-geolocation-service: TaskExecutionException: Execution failed for task ':react-native-geolocation-service:compileReleaseJavaWithJavac'

Created on 19 Sep 2019  路  7Comments  路  Source: Agontuk/react-native-geolocation-service

Hello,

I am getting a release compilation error after upgrade to latest version of react-native-geolocation-service and react-native to RN0.60.5.

Below is part of the stacktrace

> Task :react-native-geolocation-service:compileReleaseJavaWithJavac FAILED
/Users/chepkeitany/PayGo/hub-agent-app/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java:10: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app
/Users/chepkeitany/PayGo/hub-agent-app/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java:23: error: cannot find symbol
        return ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
               ^
  symbol:   variable ActivityCompat
  location: class LocationUtils
/Users/chepkeitany/PayGo/hub-agent-app/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java:24: error: cannot find symbol
            ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
            ^
  symbol:   variable ActivityCompat
  location: class LocationUtils
Note: /Users/chepkeitany/PayGo/hub-agent-app/node_modules/react-native-geolocation-service/android/src/main/java/com/agontuk/RNFusedLocation/LocationUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-geolocation-service:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Most helpful comment

Running npx jetify should solve this issue.

All 7 comments

I'm getting this issue as well

@smaldd14 Have you resolved your issue?

@Chepkeitany I got the same issue. After some googling, this work for me:
https://github.com/react-native-community/react-native-geolocation/issues/39

Running npx jetify should solve this issue.

I've tried:

rm -rf node_modules/
cd android 
./gradlew clean
cd ..
yarn
npx jetify
react-native run-android

But still getting same error :( I'm using RN 0.61.2

Try adding googlePlayServicesVersion = "16.0.0" in your build.gradle's buildscript -> ext block and see if it solves your issue.

Closing due to inactivity

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blumendorf picture blumendorf  路  11Comments

Agontuk picture Agontuk  路  5Comments

Shhzdmrz picture Shhzdmrz  路  6Comments

alexandersandberg picture alexandersandberg  路  7Comments

joaom182 picture joaom182  路  4Comments