Comments (9)
This is needed now for react-native 0.60. I'm getting support library errors when trying to compile with this library:
.../node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:21: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
.../node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:274: error: cannot find symbol
int finePermission = ContextCompat.checkSelfPermission(getReactApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION);
^
symbol: variable ContextCompat
location: class GeolocationModule
2 errors
3 warnings
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':@react-native-community_geolocation:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 5s
at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:15)
at runOnAllDevices (.../node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (.../node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
at .../node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12
at processTicksAndRejections (internal/process/task_queues.js:82:5)
at async Command.handleAction (.../node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:166:7)
from react-native-geolocation.
@louisch Give a look on this repo will help you! https://github.com/mikehardy/jetifier
from react-native-geolocation.
Thanks for adding these. We will do this, but we don't want to do it until it's necessary. You can read the details about why here:
react-native-community/discussions-and-proposals#129
from react-native-geolocation.
If you want to avoid using jetifier as suggested by @louisch, you can apply a patch to this package using patch-package.
The patch (for version 1.4.2) should be saved as patches/@react-native-community+geolocation+1.4.2.patch
file with the following contents:
diff --git a/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java b/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java
index b846a447..3112e3d5 100644
--- a/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java
+++ b/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java
@@ -18,7 +18,7 @@ import android.location.LocationProvider;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.content.ContextCompat;
+import androidx.core.content.ContextCompat;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
Personally I do not understand why this package, which was actually removed from RN 0.60 as part of Lean core effort, does not support AndroidX out of the box. It just does not make sense since RN 0.60 actually requires AndroidX.
from react-native-geolocation.
I made it work yesterday! had to manually install every dependency from react-native-community, including this one, async-storage, etc. Took me like 1 week to make my app work on RN 0.60. Thanks!
from react-native-geolocation.
Published version 2.0.2 that supports RN 0.60
from react-native-geolocation.
Tks! @matt-oakes
from react-native-geolocation.
I'm under the same issue with RN 0.60.
Do I need to upgrade to AndroidX mandatory?
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/marian-mac/Documents/dev/app/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:21: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
/Users/marian-mac/Documents/dev/app/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:274: error: cannot find symbol
int finePermission = ContextCompat.checkSelfPermission(getReactApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION);
^
symbol: variable ContextCompat
location: class GeolocationModule
2 errors
from react-native-geolocation.
As @douglaszaltron said here #37 (comment). Running npx jetify
before running ./gradlew assembleRelease
resulted in a successful build.
But I agree with @skippone. I would prefer to avoid patch-package
. I am confused why you don't want to support AndroidX out of the box. Confused and curious 😊 can you explain why?
from react-native-geolocation.
Related Issues (20)
- Issue when initializing position on Map HOT 1
- How to set up pausesLocationUpdatesAutomatically = NO
- I hope to add an API. When positioning is paused, the system will call locationManagerDidPauseLocationUpdates: callback
- Error while trying to get user current location.
- Android: track user geolocation in background mode HOT 3
- oppo Android 11 does not execute Geolocation.getCurrentPosition HOT 1
- Shouldn't type GeolocationResponse have a `mocked` attribute?
- Missing EJECTING.md
- Issue setting `expirationDuration` with `maximumAge`
- Avoid locking `RCT-Folly` version HOT 1
- Facing the crash in android HOT 1
- watchPosition options are not working as expected HOT 1
- Package '@react-native-community/geolocation' doesn't seem to be linked HOT 1
- Is it possible to obtain position from external Bluetooth GPS?
- [iOS]Only able to obtain the location immediately when the app starts HOT 4
- Typescript broken in 3.2.0 HOT 3
- App force close when GPS is disabled from the notification drawer. HOT 1
- Property 'sourceInformation' not found on object of type 'CLLocation *'
- Property 'sourceInformation' not found on object of type 'CLLocation *'
- Is there a way to monitor GPS signal status?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-geolocation.