Closed hstemplewski closed 6 years ago
Found java.lang.NoClassDefFoundError: com.marianhello.bgloc.ActivityRecognitionLocationProvider
which is very strange. It will not compile without it.
Try to update your android dependencies. https://github.com/mauron85/react-native-background-geolocation#dependencies
And also if you include many libraries. Try https://developer.android.com/studio/build/multidex.html
I found something, it start working when i switch to distance provider in config.
@mauron85 i use multidex, and i have all dependencies installed. If you will know why it not work on Activity provider, please tell me cause i dont have any idea.
And btw, please update lib, cause i have to add
compile 'com.android.support:support-v4:23+'
compile 'com.google.android.gms:play-services-location:9.4.0'
this 2 lines in node_modules/react-native-mauron85-background-geolocation/android/lib/build.gradle
I have "react-native-mauron85-background-geolocation": "^0.4.0-alpha.6"
version
Sorry. It must be specific to your device. I use ActivityProvider in Example App without any problem.
Ok but it not works on real device and symulator too (I try it on more real devices). Ok, i will use another provider. 👍 thanks for quick reply and please if you find some time add this two lines in build.gradle file. I saw issue about it. https://github.com/mauron85/react-native-background-geolocation/issues/116
Then it could be problem with your android sdk dependencies.
Also ActivityProvider depends on Google Play Services. I expect you have them installed in your simulator and devices.
Yes sure i have installed cause i use react-native-maps
, and react-native-firebase
. And i use multidex ect to have different versions.
dependencies {
compile project(':react-native-vector-icons')
compile project(':react-native-image-crop-picker')
compile(project(':react-native-mauron85-background-geolocation')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile 'com.android.support:multidex:1.0.1'
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.4.2"
compile "com.google.android.gms:play-services-maps:11.4.2"
compile(project(':react-native-firebase')) {
transitive = false
}
compile "com.google.firebase:firebase-core:11.4.2"
compile "com.google.firebase:firebase-firestore:11.4.2"
compile "com.google.firebase:firebase-auth:11.4.2"
compile "com.google.firebase:firebase-storage:11.4.2"
compile "com.google.firebase:firebase-messaging:11.4.2"
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
@hstemplewski did you fix the above issue? I also getting same issue, can you please give me suggestions that how to fix it.
here is the error i am getting while build the app
here is my build.gradle
can you please give me suggestions that how can i fix this.
check my dependencies two comments above, and do it just like me using:
compile(project(':react-native-mauron85-background-geolocation')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
and you should add multidex in build.gradle https://developer.android.com/studio/build/multidex.html
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
}
...
}
but when your app will crash on example try to use another provider. @shaikhussian
@mauron85 In "Compatibility" section there is requirement for android users:
If you are using react-native-maps or another lib that requires react-native-maps such as Exponent.js or airbnb's react-native-maps then aditionally to the instalation steps described here, you must also change node_modules...
This step is not necessary to install your library. This is typical problem and one is described and solved here - https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f
@gigby agree. That comment was written in time I was not aware of better solution. Example App should be updated. I would appreciate to create issue in example repo or even better PR.
Moving issue to https://github.com/mauron85/react-native-background-geolocation-example. Please continue discussion there.
Your Environment
Context
Expected Behavior
App not close and crashed
Actual Behavior
App crashed immediately.
Possible Fix
Steps to Reproduce
Context
Debug logs