oney / react-native-gcm-android

GCM for React Native Android
MIT License
172 stars 76 forks source link

What went wrong #8

Open isuvorov opened 8 years ago

isuvorov commented 8 years ago
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
oney commented 8 years ago

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

ghost commented 8 years ago

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

jjingrong commented 8 years ago

Try adding

    multiDexEnabled true        

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

jawadrehman commented 8 years ago

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

jawadrehman commented 8 years ago

@oney can you highlight this in your homepage

ghost commented 8 years ago

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

jawadrehman commented 8 years ago

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

ghost commented 8 years ago

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

oney commented 8 years ago

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

oney commented 8 years ago

@herby I will do

ghost commented 8 years ago

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

oney commented 8 years ago

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.

jawadrehman commented 8 years ago

@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

oney commented 8 years ago

@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

nachikettrivedi commented 8 years ago

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