neuberoliveira / react-native-gps-state

MIT License
47 stars 55 forks source link

Execution failed for task ':react-native-gps-state:compileDebugJavaWithJavac'. #32

Open kishansbs opened 5 years ago

kishansbs commented 5 years ago

Task :react-native-gps-state:compileDebugJavaWithJavac FAILED /Users/machd/Desktop/RN_Projects/GOApp/Go/node_modules/react-native-gps-state/android/src/main/java/br/com/dopaminamob/gpsstate/ GPSStateModule.java:15: error: cannot find symbol import android.support.v4.app.ActivityCompat; ^ symbol: class ActivityCompat location: package android.support.v4.app /Users/machd/Desktop/RN_Projects/GOApp/Go/node_modules/react-native-gps-state/android/src/main/java/br/com/dopaminamob/gpsstate/GPSStateModule.java:145: error: cannot find symbol ActivityCompat.requestPermissions(activity, permissions, requestCode); ^ symbol: variable ActivityCompat location: class GPSStateModule /Users/machd/Desktop/RN_Projects/GOApp/Go/node_modules/react-native-gps-state/android/src/main/java/br/com/dopaminamob/gpsstate/GPSStateModule.java:202: error: cannot find symbol return ActivityCompat.checkSelfPermission(getReactApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION); ^ symbol: variable ActivityCompat location: class GPSStateModule 3 errors

FAILURE: Build failed with an exception.

rahulnainwal107 commented 5 years ago

I am facing the same issue. react: 16.5.0 react-native: 0.57.1 react-native-gps-state: 2.0.3

bcalik commented 4 years ago

@neuberoliveira With AndroidX support, android.support.v4.app.ActivityCompat no longer exists. It should be androidx.core.app.ActivityCompat.

nipuna-g commented 4 years ago

If anyone runs into this with AndroidX you can use Jettifier to do this conversion automatically: https://www.npmjs.com/package/jetifier

Lucasark commented 4 years ago

I don't know why, but last tagged version is 2.0.3 and it is "old". Last commit PR solved this problem with AndroidX (But I don't know if it generated other, haha). To ""solved"" this just npm install last commit:

290c8e73cb565d5e858a541ec50e9a65884ee2b6

npm i git+https://github.com/neuberoliveira/react-native-gps-state#290c8e73cb565d5e858a541ec50e9a65884ee2b6

In futre, maybe 2.0.4, you can replace for version number