Closed ryanmcdermott closed 8 years ago
Did the link solve your problem?
I modified the code of your module and upgraded this in the build.gradle file:
compile 'com.google.android.gms:play-services:8.3.0'
That got it to stop throwing an error but GCM permissions request is still not showing up in emulator.
OK, this thing should be also mentioned in docs to help others prevent facing this issue.
I didn't test it, but can you test it in device?
Otherwise, you can run adb logcat
in terminal and run the app, and then try searching text GCM Registration Token
or Failed to complete token refresh
. It will get some informations.
Tried running it on device, it crashes when starting up. Here's the adb log:
E/AndroidRuntime(18628): FATAL EXCEPTION: main
E/AndroidRuntime(18628): Process: com.app.name, PID: 18628
E/AndroidRuntime(18628): java.lang.UnsatisfiedLinkError: could find DSO to load: libreactnativejni.so
E/AndroidRuntime(18628): at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:213)
E/AndroidRuntime(18628): at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:178)
E/AndroidRuntime(18628): at com.facebook.react.bridge.JSCJavaScriptExecutor.<clinit>(JSCJavaScriptExecutor.java:19)
E/AndroidRuntime(18628): at com.facebook.react.ReactInstanceManager.onJSBundleLoadedFromServer(ReactInstanceManager.java:310)
E/AndroidRuntime(18628): at com.facebook.react.ReactInstanceManager.initializeReactContext(ReactInstanceManager.java:321)
E/AndroidRuntime(18628): at com.facebook.react.ReactInstanceManager.attachMeasuredRootView(ReactInstanceManager.java:265)
E/AndroidRuntime(18628): at com.facebook.react.ReactRootView$1.run(ReactRootView.java:105)
E/AndroidRuntime(18628): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(18628): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(18628): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(18628): at android.app.ActivityThread.main(ActivityThread.java:5310)
E/AndroidRuntime(18628): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18628): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(18628): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
E/AndroidRuntime(18628): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Try running it on yours if you can. If there's an example project you have that would be great.
No problem. Here you go https://github.com/oney/TestGcm I run the app in my device with Android 4.1.2, and it just works Logs are
D/ReactNativeJS(29078): 'Running application "TestGcm" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'
D/ReactNativeJS(29078): 'send gcm token to server', 'eoupdMSUPFI:APA91bFdAfjIVcs4dWkhqX8trwHGvStiDOwF2e1QNzSBVIC6qJha-6hjWNDi8gLy0uxldQtq9zHqZOUqw9tJs8MR5wIbvvltGjuo0AxSglcFb8KDKdCAbz4_vW2vSvB3CV2OP1l2Wq1D'
Maybe your problem is related to this. What is your device?
I test the demo app in Genymotion simulator(Google Galaxy Nexus 4.1.1 API 16). It can't get the token. adb logcat shows
D/GcmRegistrationService( 998): Failed to complete token refresh
D/GcmRegistrationService( 998): java.io.IOException: MISSING_INSTANCEID_SERVICE
D/GcmRegistrationService( 998): at com.google.android.gms.iid.zzc.zza(Unknown Source)
D/GcmRegistrationService( 998): at com.google.android.gms.iid.zzc.zzb(Unknown Source)
D/GcmRegistrationService( 998): at com.google.android.gms.iid.zzc.zza(Unknown Source)
D/GcmRegistrationService( 998): at com.google.android.gms.iid.InstanceID.zzc(Unknown Source)
D/GcmRegistrationService( 998): at com.google.android.gms.iid.InstanceID.getToken(Unknown Source)
D/GcmRegistrationService( 998): at com.oney.gcm.GcmRegistrationService.onHandleIntent(GcmRegistrationService.java:38)
D/GcmRegistrationService( 998): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
D/GcmRegistrationService( 998): at android.os.Handler.dispatchMessage(Handler.java:99)
D/GcmRegistrationService( 998): at android.os.Looper.loop(Looper.java:137)
D/GcmRegistrationService( 998): at android.os.HandlerThread.run(HandlerThread.java:60)
I/ActivityManager( 293): No longer want com.android.contacts (pid 662): hidden #16
It seems that GCM doesn't work in Genymotion simulator
Thanks for the example project! I'm using an Android device that I believe is experiencing the same issue as the 64-bit one you posted. Let's keep this GitHub issue open for now, while I work on resolving it. For now I'll try getting your TestGcm to work, then I'll go back to my app.
not sure what , why or how but adding google-services.json to react-native-gcm-android folder (i also it inside the android directory + android/build ((lots of trial and error)) + updating to 8.3.0 and classpath to classpath 'com.google.gms:google-services:1.5.0-beta2'
got rid of the error for me
nevermind the upgrading bit.
noticed that i got this error instead No matching client found for package name 'com.oney.gcm'
@jawadrehman Are you testing demo project(https://github.com/oney/TestGcm)? And what is your device?
even with the demo project i got that message, but it does get the token
@oney Hi there, I was getting the same issue but managed to resolve it in a very simple way. I had to remove the apply plugin line for google services from your modules build.gradle. Worked perfectly after doing that. I created a PR with the fix.
I put this one: compile "com.google.firebase:firebase-database:9.2.0" sync with gradle and works for me.
after modifying your build.gradle file
i.e Project-level build.gradle (
App-level build.gradle (<project>/<app-module>/build.gradle):
dependencies {
// Add this line
compile 'com.google.firebase:firebase-core:16.0.0'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
NOTE: then copy the json file you downloaded and paste it twice as in the image above. and you're good to go.
for me removing "apply plugin: 'com.google.gms.google-services'" from app level gradle file worked
Following the instructions listed in the README as well as on Android's tutorial I'm still getting the error below:
I put the google-services.json in the
android/app
directory. Have you seen this error?