react-native-gcm-android icon indicating copy to clipboard operation
react-native-gcm-android copied to clipboard

What went wrong

Open isuvorov opened this issue 9 years ago • 15 comments

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

isuvorov avatar Nov 29 '15 18:11 isuvorov

Can you try this demo project? And see whether the same error happens. https://github.com/oney/TestGcm

oney avatar Nov 29 '15 18:11 oney

You must have some packages from "Extras" installed in android sdk, don't remember which ones.

ghost avatar Dec 07 '15 13:12 ghost

Try adding

    multiDexEnabled true        

within the defaultConfig{} block, inside your android/app/build.gradle

jjingrong avatar Dec 08 '15 00:12 jjingrong

you need to install Google Play Services and Google Repository from the android sdk @isuvorov

jawadrehman avatar Dec 11 '15 11:12 jawadrehman

@oney can you highlight this in your homepage

jawadrehman avatar Dec 11 '15 11:12 jawadrehman

Thing worth one more highlight is people should NOT multiDexEnable true even if someone advises them to.

ghost avatar Dec 11 '15 11:12 ghost

@herby can you give any insight on https://github.com/oney/react-native-gcm-android/issues/3

jawadrehman avatar Dec 11 '15 15:12 jawadrehman

@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).

ghost avatar Dec 11 '15 16:12 ghost

@jawadrehman Sure, but how to install Google Play Services?

oney avatar Dec 11 '15 16:12 oney

@herby I will do

oney avatar Dec 11 '15 16:12 oney

@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.

ghost avatar Dec 11 '15 17:12 ghost

Run command android to open Android SDK Manager. And find Google Play Services and Google Repository in Extras like below SDK

It's super weird that it shows I don't install Google Play Services and Google Repository.

oney avatar Dec 11 '15 17:12 oney

@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 avatar Dec 11 '15 17:12 jawadrehman

@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

oney avatar Dec 15 '15 17:12 oney

@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.

nachikettrivedi avatar May 18 '16 12:05 nachikettrivedi