Comments (24)
For me, app crashes right after starts
@Agontuk 's answer worked for me.
I changed following
dependencies {
compile(project(':react-native-geolocation-service')){
compile(project(':react-native-maps'))
......
}
to
dependencies {
compile(project(':react-native-geolocation-service')){
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile 'com.google.android.gms:play-services-location:11.0.0'
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:11.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.0'
......
}
Just doing following didn't work
dependencies {
...
compile(project(':react-native-geolocation-service')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile 'com.google.android.gms:play-services-location:11.0.0'
}
That means, you need to exclude all the play-services-xxxx modules used in every lib that uses play services.
from react-native-geolocation-service.
react-native-camera seems to also use play service plugin. Can you try this instead:
dependencies {
compile(project(':react-native-geolocation-service')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile project(':react-native-fetch-blob')
compile project(':react-native-android-location-services-dialog-box')
compile project(':react-native-android-settings-library')
compile project(':react-native-open-setting')
compile project(':react-native-fs')
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile(project(':react-native-camera')) {
exclude group: 'com.google.android.gms', module: 'play-services-vision'
}
compile(project(':react-native-fcm')) {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-messaging'
}
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:24.0.0"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.google.android.gms:play-services-location:11.0.0'
compile 'com.google.android.gms:play-services-vision:11.0.0'
}
If this doesn't work, try to create a demo repository with this issue so I can clone it & test.
from react-native-geolocation-service.
Provide a crash log otherwise I won't know what happened.
from react-native-geolocation-service.
Alright, thanks for the quick reply any ideas on how I can log this crash? Do I have to use an external service like Crashlytics? I'm sorry I'm quite new at android development
from react-native-geolocation-service.
In terminal, run adb shell logcat "*:E" "*:S"
, then launch the app. If it crashes, there'll new logs in terminal.
from react-native-geolocation-service.
This isn't giving me a log maybe because my app is crashing right after. I ran adb logcat
instead and it gave a huge log. I'm pasting some of it below:
02-08 21:50:20.205 14636 14802 E AndroidRuntime: FATAL EXCEPTION: Thread-5
02-08 21:50:20.205 14636 14802 E AndroidRuntime: Process: com.meshedu, PID: 14636
02-08 21:50:20.205 14636 14802 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbce;
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.google.android.gms.location.FusedLocationProviderClient.(Unknown Source)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.agontuk.RNFusedLocation.RNFusedLocationModule.(RNFusedLocationModule.java:95)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.agontuk.RNFusedLocation.RNFusedLocationPackage.createNativeModules(RNFusedLocationPackage.java:26)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1009)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:944)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:743)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at java.lang.Thread.run(Thread.java:762)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzbce" on path: DexPathList[[zip file "/data/app/com.meshedu-1/base.apk"],nativeLibraryDirectories=[/data/app/com.meshedu-1/lib/arm, /system/fake-libs, /data/app/com.meshedu-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
02-08 21:50:20.205 14636 14802 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
Is this helpful at all?
from react-native-geolocation-service.
You're probably using other google play service libraries that are using different versions. You need to use the same version for all google play service plugin. Can you share which libraries you are using in your project ?
from react-native-geolocation-service.
Thanks for helping out, these are the android dependencies I'm using:
dependencies {
compile project(':react-native-geolocation-service')
compile project(':react-native-fetch-blob')
compile project(':react-native-android-location-services-dialog-box')
compile project(':react-native-android-settings-library')
compile project(':react-native-open-setting')
compile project(':react-native-fs')
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile project(':react-native-camera')
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:11.0.0'
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:24.0.0"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.google.android.gms:play-services-location:11.0.0'
}
from react-native-geolocation-service.
Check if this works for you.
dependencies {
compile(project(':react-native-geolocation-service')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile project(':react-native-fetch-blob')
compile project(':react-native-android-location-services-dialog-box')
compile project(':react-native-android-settings-library')
compile project(':react-native-open-setting')
compile project(':react-native-fs')
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile project(':react-native-camera')
compile(project(':react-native-fcm')) {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-messaging'
}
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:24.0.0"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.google.android.gms:play-services-location:11.0.0'
}
from react-native-geolocation-service.
Thanks for the quick replies! it still is crashing instantly saying "App has stopped working" on my phone.
This is the logcat
--------- beginning of crash
--------- beginning of system
--------- beginning of main
from react-native-geolocation-service.
Can you try checking the logs again? Try with adb shell logcat
and when app crashes you'll see bunch of new logs. Just copy the relevant log and post it here.
from react-native-geolocation-service.
I have shortened the crash log because it was huge to the last bit which seems most relevant. Here you go:
I/art (16810): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzcez> I/art (16810): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzcez> E/AndroidRuntime(16810): FATAL EXCEPTION: Thread-1601 E/AndroidRuntime(16810): Process: com.meshedu, PID: 16810 E/AndroidRuntime(16810): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbce; E/AndroidRuntime(16810): at com.google.android.gms.location.FusedLocationProviderClient.<init>(Unknown Source) E/AndroidRuntime(16810): at com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source) E/AndroidRuntime(16810): at com.agontuk.RNFusedLocation.RNFusedLocationModule.<init>(RNFusedLocationModule.java:95) E/AndroidRuntime(16810): at com.agontuk.RNFusedLocation.RNFusedLocationPackage.createNativeModules(RNFusedLocationPackage.java:26) E/AndroidRuntime(16810): at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106) E/AndroidRuntime(16810): at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1009) E/AndroidRuntime(16810): at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:944) E/AndroidRuntime(16810): at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109) E/AndroidRuntime(16810): at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:743) E/AndroidRuntime(16810): at java.lang.Thread.run(Thread.java:818) E/AndroidRuntime(16810): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzbce" on path: DexPathList[[zip file "/data/app/com.meshedu-1/base.apk"],nativeLibraryDirectories=[/data/app/com.meshedu-1/lib/x86, /vendor/lib, /system/lib]] E/AndroidRuntime(16810): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) E/AndroidRuntime(16810): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) E/AndroidRuntime(16810): at java.lang.ClassLoader.loadClass(ClassLoader.java:469) E/AndroidRuntime(16810): ... 10 more E/AndroidRuntime(16810): Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.internal.zzbce E/AndroidRuntime(16810): at java.lang.Class.classForName(Native Method) E/AndroidRuntime(16810): at java.lang.BootClassLoader.findClass(ClassLoader.java:781) E/AndroidRuntime(16810): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) E/AndroidRuntime(16810): at java.lang.ClassLoader.loadClass(ClassLoader.java:504) E/AndroidRuntime(16810): ... 11 more E/AndroidRuntime(16810): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available W/ActivityManager( 629): Force finishing activity com.meshedu/.MainActivity
from react-native-geolocation-service.
Would information before this java class rejection error be useful to you too?
from react-native-geolocation-service.
These logs are enough for now. Did you run react-native run-android
after updating the build.gradle file ? You need to build again after any native change. Also just to be sure, please clone the repo and check if the example project works on your end.
from react-native-geolocation-service.
Yes I ran react-native run-android
after linking the library. Alright I will clone it and get back to you
from react-native-geolocation-service.
No, I meant after applying the dependencies change I posted earlier.
from react-native-geolocation-service.
Yes I did that too, just built it again to recheck it, and it's still crashing
from react-native-geolocation-service.
The example app does not crash on my phone but it's location request keeps timing out (I tried being outdoors and tested it too).
from react-native-geolocation-service.
Which device are you using for testing?
from react-native-geolocation-service.
I am using Samsung Galaxy J5 Prime with Android Version 7.0
from react-native-geolocation-service.
Try disabling power saving, Access battery settings > app power saving > details > Your App > disabled
and see if it helps. Also check the log after clicking Get Location
button and post it here.
As for your project, try to see if there's a mismatch between different google play plugins. You can check the dependencies by cd android && ./gradlew app:dependencies
.
from react-native-geolocation-service.
Hi, apologies for the late response. I tried my best to fix this error and changed every occurrence of play-services to 11.8.0 and this is the result of cd android && ./gradlew app:dependencies
.
+--- project :react-native-geolocation-service
| --- com.android.support:appcompat-v7:25.0.1
| +--- com.android.support:support-v4:25.0.1 -> 26.0.1
| | +--- com.android.support:support-compat:26.0.1
| | | --- com.android.support:support-annotations:26.0.1 -> 26.0.2
| | +--- com.android.support:support-media-compat:26.0.1
| | | +--- com.android.support:support-annotations:26.0.1 -> 26.0.2
| | | --- com.android.support:support-compat:26.0.1 ()
| | +--- com.android.support:support-core-utils:26.0.1
| | | +--- com.android.support:support-annotations:26.0.1 -> 26.0.2
| | | --- com.android.support:support-compat:26.0.1 ()
| | +--- com.android.support:support-core-ui:26.0.1
| | | +--- com.android.support:support-annotations:26.0.1 -> 26.0.2
| | | --- com.android.support:support-compat:26.0.1 ()
| | --- com.android.support:support-fragment:26.0.1
| | +--- com.android.support:support-compat:26.0.1 ()
| | +--- com.android.support:support-core-ui:26.0.1 ()
| | --- com.android.support:support-core-utils:26.0.1 ()
| +--- com.android.support:support-vector-drawable:25.0.1
| | --- com.android.support:support-compat:25.0.1 -> 26.0.1 ()
| --- com.android.support:animated-vector-drawable:25.0.1
| --- com.android.support:support-vector-drawable:25.0.1 ()
+--- project :react-native-fetch-blob
| --- com.facebook.react:react-native:+ -> 0.46.4
| +--- javax.inject:javax.inject:1
| +--- com.android.support:appcompat-v7:23.0.1 -> 25.0.1 ()
| +--- com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.0.0
| | --- com.facebook.fbui.textlayoutbuilder:staticlayout-proxy:1.0
| +--- com.facebook.fresco:fresco:1.0.1
| | +--- com.facebook.fresco:drawee:1.0.1
| | | --- com.facebook.fresco:fbcore:1.0.1
| | +--- com.facebook.fresco:fbcore:1.0.1
| | --- com.facebook.fresco:imagepipeline:1.0.1
| | +--- com.parse.bolts:bolts-tasks:1.4.0
| | +--- com.facebook.fresco:fbcore:1.0.1
| | --- com.facebook.fresco:imagepipeline-base:1.0.1
| | +--- com.parse.bolts:bolts-tasks:1.4.0
| | --- com.facebook.fresco:fbcore:1.0.1
| +--- com.facebook.fresco:imagepipeline-okhttp3:1.0.1
| | +--- com.squareup.okhttp3:okhttp:3.0.1 -> 3.6.0
| | | --- com.squareup.okio:okio:1.11.0 -> 1.13.0
| | +--- com.facebook.fresco:fbcore:1.0.1
| | --- com.facebook.fresco:imagepipeline:1.0.1 ()
| +--- com.facebook.soloader:soloader:0.1.0
| +--- com.google.code.findbugs:jsr305:3.0.0
| +--- com.squareup.okhttp3:okhttp:3.6.0 ()
| +--- com.squareup.okhttp3:okhttp-urlconnection:3.6.0
| | --- com.squareup.okhttp3:okhttp:3.6.0 ()
| +--- com.squareup.okio:okio:1.13.0
| --- org.webkit:android-jsc:r174650
+--- project :react-native-android-location-services-dialog-box
| --- com.facebook.react:react-native:+ -> 0.46.4 ()
+--- project :react-native-android-settings-library
| --- com.facebook.react:react-native:0.20.+ -> 0.46.4 ()
+--- project :react-native-open-setting
| --- com.facebook.react:react-native:+ -> 0.46.4 ()
+--- project :react-native-fs
| --- com.facebook.react:react-native:+ -> 0.46.4 ()
+--- project :react-native-vector-icons
| --- com.facebook.react:react-native:+ -> 0.46.4 ()
+--- project :react-native-linear-gradient
| --- com.facebook.react:react-native:+ -> 0.46.4 ()
+--- project :react-native-camera
| +--- com.facebook.react:react-native:+ -> 0.46.4 ()
| +--- com.google.zxing:core:3.2.1
| +--- com.drewnoakes:metadata-extractor:2.9.1
| | --- com.adobe.xmp:xmpcore:5.1.2
| +--- com.google.android.gms:play-services-vision:11.8.0
| | +--- com.google.android.gms:play-services-base:11.8.0
| | | +--- com.google.android.gms:play-services-basement:11.8.0
| | | | +--- com.android.support:support-v4:25.2.0 -> 26.0.1 ()
| | | | --- com.google.android.gms:play-services-basement-license:11.8.0
| | | +--- com.google.android.gms:play-services-tasks:11.8.0
| | | | +--- com.google.android.gms:play-services-basement:11.8.0 ()
| | | | --- com.google.android.gms:play-services-tasks-license:11.8.0
| | | --- com.google.android.gms:play-services-base-license:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 ()
| | +--- com.google.android.gms:play-services-vision-common:11.8.0
| | | +--- com.google.android.gms:play-services-base:11.8.0 ()
| | | +--- com.google.android.gms:play-services-basement:11.8.0 ()
| | | --- com.google.android.gms:play-services-vision-common-license:11.8.0
| | --- com.google.android.gms:play-services-vision-license:11.8.0
| +--- com.android.support:exifinterface:26.0.2
| | --- com.android.support:support-annotations:26.0.2
| --- com.github.react-native-community:cameraview:df60b07573
| +--- com.android.support:support-annotations:26.0.1 -> 26.0.2
| --- com.android.support:support-v4:26.0.1 ()
+--- project :react-native-fcm
| +--- com.facebook.react:react-native:+ -> 0.46.4 ()
| --- me.leolin:ShortcutBadger:1.1.17
+--- com.android.support:appcompat-v7:24.0.0 -> 25.0.1 ()
+--- com.facebook.react:react-native:+ -> 0.46.4 ()
+--- com.google.firebase:firebase-core:11.8.0
| --- com.google.firebase:firebase-analytics:11.8.0
| +--- com.google.android.gms:play-services-basement:11.8.0 ()
| +--- com.google.firebase:firebase-common:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 ()
| | +--- com.google.android.gms:play-services-tasks:11.8.0 ()
| | --- com.google.firebase:firebase-common-license:11.8.0
| +--- com.google.firebase:firebase-analytics-impl:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 ()
| | +--- com.google.firebase:firebase-iid:11.8.0
| | | +--- com.google.android.gms:play-services-basement:11.8.0 ()
| | | +--- com.google.firebase:firebase-common:11.8.0 ()
| | | +--- com.google.android.gms:play-services-tasks:11.8.0 ()
| | | --- com.google.firebase:firebase-iid-license:11.8.0
| | +--- com.google.firebase:firebase-common:11.8.0 ()
| | +--- com.google.android.gms:play-services-tasks:11.8.0 ()
| | --- com.google.firebase:firebase-analytics-impl-license:11.8.0
| --- com.google.firebase:firebase-analytics-license:11.8.0
+--- com.google.firebase:firebase-messaging:11.8.0
| +--- com.google.firebase:firebase-iid:11.8.0 ()
| +--- com.google.android.gms:play-services-basement:11.8.0 ()
| +--- com.google.firebase:firebase-common:11.8.0 ()
| --- com.google.firebase:firebase-messaging-license:11.8.0
--- com.google.android.gms:play-services-location:11.8.0
+--- com.google.android.gms:play-services-base:11.8.0 ()
+--- com.google.android.gms:play-services-basement:11.8.0 ()
+--- com.google.android.gms:play-services-tasks:11.8.0 (*)
--- com.google.android.gms:play-services-location-license:11.8.0
This seems to be okay to me, could the error be somewhere else? Unless I'm missing something of course
from react-native-geolocation-service.
Hi could running this library on a previous react-native version be an issue?
from react-native-geolocation-service.
I feel that react-native version made a difference, I created a new react-native init project with the same android dependencies and this wasn't an issue anymore.
from react-native-geolocation-service.
Related Issues (20)
- Not getting location prompt while opening the app for ionic3
- Geolocation.getCurrentPosition always returns San Fransisco lat/long HOT 1
- Receiving longitude and latitude as 0
- Latitude is coming as 0 in ios where longitude has a valid value HOT 5
- Unable to get the current location in Android when we are using wifi HOT 2
- watchID always 0 when i called watchPosition HOT 2
- React-native-geolocation-service failing when building on xcode it says "underlying Objective-C module 'react_native_geolocation_service' not found", "failed to verify module interface of 'react_native_geolocation_service' due to the errors above; the textual interface may be broken" HOT 2
- GPS accuracy lack HOT 1
- Crash on Xcode 15 RC
- watchPosition not working consistently on iOS
- upgrading to googlePlayServicesVersion 21.0.1 HOT 2
- Only update location once every 5 minutes not working as expected
- Search for location in the background - Android HOT 3
- In latest React-native 0.73 version it gives error of gerCurrentPosition not defined when i use same code react-native lesser version it works perfect but in the latest version it doesn't work
- Restricting to multiple countries? HOT 1
- Swift Requirement and iOS 12 crashes
- Could not invoke RNFusedLocation.startObserving HOT 2
- [TypeError: Cannot read property 'getCurrentPosition' of null] HOT 3
- GooglePlayServicesMissingManifestValueException at getCurrentPosition()
- Usage of Insecure random generator (Instances of java.util.Random) found in Testing.
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-service.