radarlabs / react-native-radar

React Native module for Radar, the leading geofencing and location tracking platform
https://radar.com
Apache License 2.0
170 stars 32 forks source link

Can't use with React Native Push Notifications #56

Closed shivjeet-git closed 5 years ago

shivjeet-git commented 5 years ago

Describe the bug I'm not able to use React Native Push Notifications or React Native Firebase with Radar. As soon as I install Radar apps keeps on crashing. SOme conflict in between these apps maybe.

To Reproduce Steps to reproduce the behavior:

  1. Install React Native Push Notifications
  2. Then Install Radar
  3. After compiling the app starts stopping on react-native run-android

Expected behavior Both apps should work together without crashing the app. Both are working separately but not together.

Metadata (please complete the following information):

russellcullen commented 5 years ago

Thanks for the report, would you mind sharing the stacktrace of the crash from logcat?

shivjeet-git commented 5 years ago

How can I get that ? By using adb logcat from /android directory ?

It keeps on printing.

russellcullen commented 5 years ago

Just the stacktrace of the crash is needed, not the whole log output thanks

shivjeet-git commented 5 years ago

Can you please help me how can I get that or from where ?

russellcullen commented 5 years ago

Logcat is correct, but you can just paste the error that shows up when the crash occurs instead of the full output.

Just a guess but I suspect this is due to conflicting Google play services versions from the two SDKs since the Ad ID API was moved to a separate package in new versions. Does declaring a dependency on Google play services ads in your app build.gradle help:

implementation "com.google.android.gms:play-services-ads:16.0.0"

shivjeet-git commented 5 years ago

I tried adding above..still the same result....Build is successful just app keeps stopping.

Please find below the error that came up when app crashes:

12-26 14:19:02.790 1773 1996 D EGL_emulation: eglMakeCurrent: 0xe2629d80: ver 3 1 (tinfo 0xe262cdf0) 12-26 14:19:02.796 1440 1440 D : HostConnection::get() New Host Connection established 0xebe23900, tid 1440 12-26 14:19:02.796 1773 1996 D EGL_emulation: eglMakeCurrent: 0xe2629d80: ver 3 1 (tinfo 0xe262cdf0) 12-26 14:19:02.802 1439 1498 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496 12-26 14:19:02.805 1773 1786 W asset : Asset path /data/app/com.flowersdelivery-aGw1KWtHfJuiFGCZqE6Q5A==/base.apk is neither a directory nor file (type=1). 12-26 14:19:02.805 1773 1786 E ResourcesManager: failed to add asset path /data/app/com.flowersdelivery-aGw1KWtHfJuiFGCZqE6Q5A==/base.apk 12-26 14:19:02.805 1773 1786 W PackageManager: Failure retrieving resources for com.flowersdelivery 12-26 14:19:02.805 1773 1786 W asset : Asset path /data/app/com.flowersdelivery-aGw1KWtHfJuiFGCZqE6Q5A==/base.apk is neither a directory nor file (type=1). 12-26 14:19:02.805 1773 1786 E ResourcesManager: failed to add asset path /data/app/com.flowersdelivery-aGw1KWtHfJuiFGCZqE6Q5A==/base.apk 12-26 14:19:02.805 1773 1786 W PackageManager: Failure retrieving resources for com.flowersdelivery 12-26 14:19:02.805 1773 1786 W asset : Asset path /data/app/com.flowersdelivery-aGw1KWtHfJuiFGCZqE6Q5A==/base.apk is neither a directory nor file (type=1). 12-26 14:19:02.805 1773 1786 E ResourcesManager: failed to add asset path /data/app/com.flowersdelivery-aGw1KWtHfJuiFGCZqE6Q5A==/base.apk 12-26 14:19:02.805 1773 1786 W PackageManager: Failure retrieving resources for com.flowersdelivery 12-26 14:19:02.816 1773 1996 D EGL_emulation: eglMakeCurrent: 0xe2629d80: ver 3 1 (tinfo 0xe262cdf0) 12-26 14:19:02.816 1439 1498 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496 12-26 14:19:02.827 1439 1498 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496 12-26 14:19:02.845 1773 1786 D : HostConnection::get() New Host Connection established 0xca1cb480, tid 1786 12-26 14:19:02.848 2151 2537 W GCoreFlp: No location to return for getLastLocation() 12-26 14:19:02.859 2205 2332 D EGL_emulation: eglMakeCurrent: 0xcec75880: ver 3 1 (tinfo 0xcec779d0) 12-26 14:19:02.862 1773 1790 D : HostConnection::get() New Host Connection established 0xe2823b00, tid 1790 12-26 14:19:02.890 1440 1440 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) 12-26 14:19:02.890 1440 1440 D : HostConnection::get() New Host Connection established 0xebe23900, tid 1440 12-26 14:19:02.891 1440 1440 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) 12-26 14:19:02.898 1440 1440 D : HostConnection::get() New Host Connection established 0xebe23900, tid 1440 12-26 14:19:02.900 1440 1440 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) 12-26 14:19:02.901 1440 1440 D : HostConnection::get() New Host Connection established 0xebe23900, tid 1440 12-26 14:19:02.901 1440 1440 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) 12-26 14:19:02.915 1440 1440 D : HostConnection::get() New Host Connection established 0xebe23900, tid 1440 12-26 14:19:02.953 2382 2865 I Icing : Indexing com.google.android.gms-apps from com.google.android.gms 12-26 14:19:03.062 2382 2865 I Icing : Indexing done com.google.android.gms-apps 12-26 14:19:03.068 2382 2865 I Icing : Indexing com.google.android.gms-internal.3p:MobileApplication from com.google.android.gms 12-26 14:19:03.076 1657 1705 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) 12-26 14:19:03.077 1657 1705 D : HostConnection::get() New Host Connection established 0xcbb71740, tid 1705 12-26 14:19:03.078 1657 1705 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) 12-26 14:19:03.103 2382 2865 I Icing : Indexing done com.google.android.gms-internal.3p:MobileApplication 12-26 14:19:03.113 2382 2865 I Icing : Indexing com.google.android.gms-apps from com.google.android.gms 12-26 14:19:03.116 2382 2865 I Icing : Indexing done com.google.android.gms-apps 12-26 14:19:03.357 2205 2332 W OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer... 12-26 14:19:05.455 2151 4027 W ctxmgr : [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):IndoorOutdoorProducer, vrsn=13280000, 0, 3pPkg = null , 3pMdlId = null , pid = 2151). Was: 3 for 57, account#-517948760# 12-26 14:19:10.455 2151 4118 W ctxmgr : [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):IndoorOutdoorProducer, vrsn=13280000, 0, 3pPkg = null , 3pMdlId = null , pid = 2151). Was: 3 for 57, account#-517948760# 12-26 14:19:11.083 1657 1675 E BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0} 12-26 14:19:12.907 1657 1672 W ActivityManager: Activity destroy timeout for ActivityRecord{8d3972c u0 com.flowersdelivery/.MainActivity t179 f} 12-26 14:19:15.458 2151 4004 W ctxmgr : [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):IndoorOutdoorProducer, vrsn=13280000, 0, 3pPkg = null , 3pMdlId = null , pid = 2151). Was: 3 for 57, account#-517948760# 12-26 14:19:20.459 2151 4004 W ctxmgr : [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):IndoorOutdoorProducer, vrsn=13280000, 0, 3pPkg = null , 3pMdlId = null , pid = 2151). Was: 3 for 57, account#-517948760# 12-26 14:19:25.473 2151 4027 W ctxmgr : [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):IndoorOutdoorProducer, vrsn=13280000, 0, 3pPkg = null , 3pMdlId = null , pid = 2151). Was: 3 for 57, account#-517948760# 12-26 14:19:30.480 2151 4123 W ctxmgr : [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):IndoorOutdoorProducer, vrsn=13280000, 0, 3pPkg = null , 3pMdlId = null , pid = 2151). Was: 3 for 57, account#-517948760# 12-26 14:19:31.672 1657 1671 E memtrack: Couldn't load memtrack module 12-26 14:19:31.672 1657 1671 W android.os.Debug: failed to get memory consumption info: -1 12-26 14:19:33.851 1440 1461 D hwcomposer: hw_composer sent 342 syncs in 60s

russellcullen commented 5 years ago

There doesn't seem to be any crash in the above logs, this is odd.

Mismatched Google play services can sometimes cause runtime crashes while still compiling. Would you mind running ./gradlew app:dependencies and sharing what versions of Google play services libs are being used?

russellcullen commented 5 years ago

Also, it may help to filter your logcat output to just errors with adb logcat *:E

russellcullen commented 5 years ago

Does manually matching location version help?

implementation 'com.google.android.gms:play-services-location:16.0.0

shivjeet-git commented 5 years ago

After doing adb logcat *.E

I get the log below(if that helps):

2-26 14:36:05.904 1661 1675 E memtrack: Couldn't load memtrack module 12-26 14:36:08.194 1661 1675 E memtrack: Couldn't load memtrack module 12-26 14:36:12.555 3539 3539 E asset : setgid: Operation not permitted 12-26 14:36:12.791 3541 3548 E zygote : Failed writing handshake bytes (-1 of 14): Broken pipe 12-26 14:36:14.314 1530 1716 E : Couldn't opendir /data/app/vmdl1496087814.tmp: No such file or directory 12-26 14:36:14.314 1530 1716 E installd: Failed to delete /data/app/vmdl1496087814.tmp: No such file or directory 12-26 14:36:15.033 3604 3604 E AndroidRuntime: FATAL EXCEPTION: main 12-26 14:36:15.033 3604 3604 E AndroidRuntime: Process: com.flowersdelivery, PID: 3604 12-26 14:36:15.033 3604 3604 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf; 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at com.google.android.gms.location.LocationServices.(Unknown Source:0) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at com.google.android.gms.location.LocationServices.getGeofencingClient(Unknown Source:0) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.LocationModule.geofencingClient(LocationModule.kt:20) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.LocationModule_GeofencingClientFactory.proxyGeofencingClient(LocationModule_GeofencingClientFactory.java:32) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.LocationModule_GeofencingClientFactory.provideInstance(LocationModule_GeofencingClientFactory.java:23) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.LocationModule_GeofencingClientFactory.get(LocationModule_GeofencingClientFactory.java:19) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.LocationModule_GeofencingClientFactory.get(LocationModule_GeofencingClientFactory.java:10) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.shadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.location.LocationManager_Factory.provideInstance(LocationManager_Factory.java:55) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.location.LocationManager_Factory.get(LocationManager_Factory.java:37) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.location.LocationManager_Factory.get(LocationManager_Factory.java:11) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.shadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.DaggerRadarComponent.injectRadar(DaggerRadarComponent.java:147) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.di.DaggerRadarComponent.inject(DaggerRadarComponent.java:137) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at io.radar.sdk.internal.RadarInitProvider.onCreate(RadarInitProvider.kt:24) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:1917) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:1892) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.app.ActivityThread.-wrap1(Unknown Source:0) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/com.flowersdelivery-kro-EZhmOyviY1qThhMfcw==/base.apk"],nativeLibraryDirectories=[/data/app/com.flowersdelivery-kro-EZhmOyviY1qThhMfcw==/lib/x86, /data/app/com.flowersdelivery-kro-EZhmOyviY1qThhMfcw==/base.apk!/lib/x86, /system/lib, /vendor/lib]] 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379) 12-26 14:36:15.033 3604 3604 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

shivjeet-git commented 5 years ago

No, it results in same

below is what i have in dependencies dependencies { compile project(':react-native-push-notification') compile project(':react-native-radar') compile project(':react-native-gesture-handler') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation 'io.radar:sdk:2.1.+' implementation "com.facebook.react:react-native:+" // From node_modules implementation 'com.google.android.gms:play-services-location:16.0.0' }

russellcullen commented 5 years ago

This looks like the same issue as https://github.com/radarlabs/react-native-radar/issues/40

Does that resolve your crash?

shivjeet-git commented 5 years ago

No. I added these compile 'com.google.android.gms:play-services-maps:16.0.0' compile 'com.google.android.gms:play-services-location:16.0.0'

But no luck still crashing

russellcullen commented 5 years ago

Hm that's very odd, is it possible you're not re-compiling the app before running? This would mean the newly declared dependencies are not being pulled in

shivjeet-git commented 5 years ago

I'm uninstalling the app from the simulator. Then I'm doing .gradlew clean and then react-native run-android

Let me know if you want me to try something else or I'm missing something.

russellcullen commented 5 years ago

That should be sufficient. Would you mind also adding the ads dependency as well, just in case haha.

shivjeet-git commented 5 years ago

By ads dependency you mean : implementation "com.google.android.gms:play-services-ads:16 ?

shivjeet-git commented 5 years ago

Giving me this error after adding. Am i missing something ?

Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find com.google.android.gms:play-services-ads:16. Searched in the following locations: file:/C:/Users/shivj/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom file:/C:/Users/shivj/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar file:/C:/Users/shivj/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom file:/C:/Users/shivj/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar file:/C:/Users/shivj/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom file:/C:/Users/shivj/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar file:/C:/Users/shivj/.m2/repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom file:/C:/Users/shivj/.m2/repository/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar https://jcenter.bintray.com/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom https://jcenter.bintray.com/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar file:/E:/Projects/s/node_modules/react-native/android/com/google/android/gms/play-services-ads/16/play-services-ads-16.pom file:/E:/Projects/s/node_modules/react-native/android/com/google/android/gms/play-services-ads/16/play-services-ads-16.jar Required by: project :app

russellcullen commented 5 years ago

You'll need the full version name:

implementation "com.google.android.gms:play-services-ads:16.0.0"

shivjeet-git commented 5 years ago

If you create a fresh project and then install these two packages below https://github.com/zo0r/react-native-push-notification https://github.com/radarlabs/react-native-radar

and the linking both of them with react-native link You don't have to write a single line and it crashes and show the alert of app has stopped.

shivjeet-git commented 5 years ago

App started now...with both the packages after adding implementation "com.google.android.gms:play-services-ads:16.0.0"

So what was the issue exactly ?

russellcullen commented 5 years ago

There were just incompatible versions of Google play services, the other library was pulling in a higher version so we just needed to force location to use that version too. However, 16.0.0 version of location removed the Ads package to a separate module so that's why you need to include both

shivjeet-git commented 5 years ago

Thank you for the help!!!

russellcullen commented 5 years ago

Of course! Please reach out if you have any other issues.