react-native-gcm-android
react-native-gcm-android copied to clipboard
What went wrong
A problem occurred configuring project ':RNGcmAndroid'.
> Could not resolve all dependencies for configuration ':RNGcmAndroid:_debugCompile'.
> Could not find com.google.android.gms:play-services-measurement:8.1.0.
Searched in the following locations:
file:/home/isuvorov/.m2/repository/com/google/android/gms/play-services-measurement/8.1.0/play-services-measurement-8.1.0.pom
file:/home/isuvorov/.m2/repository/com/google/android/gms/play-services-measurement/8.1.0/play-services-measurement-8.1.0.jar
https://jcenter.bintray.com/com/google/android/gms/play-services-measurement/8.1.0/play-services-measurement-8.1.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-measurement/8.1.0/play-services-measurement-8.1.0.jar
file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-measurement/8.1.0/play-services-measurement-8.1.0.pom
file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-measurement/8.1.0/play-services-measurement-8.1.0.jar
Required by:
r2:RNGcmAndroid:unspecified
> Could not find com.google.android.gms:play-services:8.1.0.
Searched in the following locations:
file:/home/isuvorov/.m2/repository/com/google/android/gms/play-services/8.1.0/play-services-8.1.0.pom
file:/home/isuvorov/.m2/repository/com/google/android/gms/play-services/8.1.0/play-services-8.1.0.jar
https://jcenter.bintray.com/com/google/android/gms/play-services/8.1.0/play-services-8.1.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services/8.1.0/play-services-8.1.0.jar
file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services/8.1.0/play-services-8.1.0.pom
file:/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services/8.1.0/play-services-8.1.0.jar
Required by:
r2:RNGcmAndroid:unspecified
Can you try this demo project? And see whether the same error happens. https://github.com/oney/TestGcm
You must have some packages from "Extras" installed in android sdk, don't remember which ones.
Try adding
multiDexEnabled true
within the defaultConfig{} block, inside your android/app/build.gradle
you need to install Google Play Services and Google Repository from the android sdk @isuvorov
@oney can you highlight this in your homepage
Thing worth one more highlight is people should NOT multiDexEnable true
even if someone advises them to.
@herby can you give any insight on https://github.com/oney/react-native-gcm-android/issues/3
@jawadrehman I really don't know. That thing is strange. It was making problems in my project as well, now it does not and everything goes fine (though the '.json not found in root' message is still appearing during build).
@jawadrehman Sure, but how to install Google Play Services?
@herby I will do
@oney Re: how to install Google Play Services: In Windows as well as in OSX IIRC, Android SDK has this UI that manages installed parts, Google Play Services as well as Google Repository are one of the items thereof. IIRC in "Extras" section.
Run command android
to open Android SDK Manager.
And find Google Play Services and Google Repository in Extras like below
It's super weird that it shows I don't install Google Play Services and Google Repository.
@oney they are installed, its just that there's an update available.
EDIT - This might have been because of latency on part of GCM. Didnt knew that it could be a bit slower compared to APNS . Thanks for your help .
btw, after loads of fiddling around i finally made it give me a gcm token. the only issue i have now is that the messages are only recieved on the device on first app launch (so not when say app is closed / app is in another view). is it because i have a kindle fire that i installed google play services on or is it an issue.
@herby
@jawadrehman The communication between JS and native (Java) is paused when app is closed. I recommend you create a subclass of GcmListenerService to handle the notification. Demo is https://github.com/oney/TestGcm/commit/5fa36144ed015f38e4608667702b27b36a9696c2
@jawadrehman @herby @oney I have google play services and google repository already installed. I'm still facing the same error of: RNGcmAndroid' A problem occurred configuring project ':RNGcmAndroid'. Please guide.