Git Product home page Git Product logo

Comments (24)

malithjkmt avatar malithjkmt commented on May 12, 2024 12

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.

Agontuk avatar Agontuk commented on May 12, 2024 5

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.

Agontuk avatar Agontuk commented on May 12, 2024

Provide a crash log otherwise I won't know what happened.

from react-native-geolocation-service.

AngSin avatar AngSin commented on May 12, 2024

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.

Agontuk avatar Agontuk commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

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.

Agontuk avatar Agontuk commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

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.

Agontuk avatar Agontuk commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

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.

Agontuk avatar Agontuk commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

Would information before this java class rejection error be useful to you too?

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

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.

Agontuk avatar Agontuk commented on May 12, 2024

No, I meant after applying the dependencies change I posted earlier.

from react-native-geolocation-service.

AngSin avatar AngSin commented on May 12, 2024

Yes I did that too, just built it again to recheck it, and it's still crashing

from react-native-geolocation-service.

AngSin avatar AngSin commented on May 12, 2024

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.

Agontuk avatar Agontuk commented on May 12, 2024

Which device are you using for testing?

from react-native-geolocation-service.

AngSin avatar AngSin commented on May 12, 2024

I am using Samsung Galaxy J5 Prime with Android Version 7.0

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

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.

AngSin avatar AngSin commented on May 12, 2024

Hi could running this library on a previous react-native version be an issue?

from react-native-geolocation-service.

AngSin avatar AngSin commented on May 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.