问题
I downloaded the example link
ran it and it worked fine. but now I want to do it in the android studio. I try to connect the library:
compile "com.google.android.gms:play-services:6.1.71"
but the classes are not visible and the package too
android:name="com.google.android.gcm.GCMBroadcastReceiver"
how to connect the library GCM in gradle?
回答1:
You should install Google Cloud Messaging for Android Library in a SDK Manager . After doing it Android Studio will be see all classes from gcm.jar.
回答2:
You need the gcm-server.jar. Add compile("com.ganyo:gcm-server:1.0.2") in build.gradle as the following:
dependencies {
compile("com.ganyo:gcm-server:1.0.2")
}
来源:https://stackoverflow.com/questions/27246293/how-to-connect-the-library-gcm-in-gradle