Cannot resolve symbol gcm (Android Studio 0.8.9) - android

Im trying to use Google Cloud Messaging with Android Studio, but it cannot find android:name="com.google.android.gcm.GCMBaseIntentService" and the gcm and GcmIntent appears in read. I have intalled Google play services v 6.1.11.
In the build.gradle i have compile "com.google.android.gms:play-services:6.1.11" as dependency.
How, i have that installed.
I had open the google play services directoy and i havent found gcm. I have gcm installed from sdk manager but still doesnt recognize .GCMBaseIntentService and .GcmIntentService

com.google.android.gcm.GCMBaseIntentService is an old deprecated class that belonged to the deprecated gcm.jar. Since you are using Google Play Services library, there's no need for you to use GCMBaseIntentService.

Make sure you update or install 'Google Repository' on the SDK manager. Also make sure that you are pointing to the right SDK path.
Go to:
File>Project Structure> SDK Location

GCMBaseIntentService is depicted and part of play service lib (3.1+) so you don't have to add any other jar file. gcm.jar is obsolete now, you can find it in SDK also.
According to android documentation add below line in gradle.build file (latest version)
dependencies {
compile "com.google.android.gms:play-services:6.5.87"
}
For more info
http://developer.android.com/reference/com/google/android/gms/gcm/GoogleCloudMessaging.html

Related

Cordova add google play services

I just added OneSignal to my Cordova project. This appears to use Google Play services i.e. (I get a message "No valid Google Play services APK found"). I was wondering the best approach for adding it.
I have Google Play services v8.4.89 installed on my phone.
I have Google Play services installed via the SDK manager:
This creates a google_play_services folder (without a lot in it):
UPDATE
As per this Google has broken down Google Play Services into multiple libraries (.aar) located at:
android-sdk\extras\google\m2repository\com\google\android\gms
build.gradle dependencies:
I'm a little unsure of what to do next. I thought I could have potentially used this.
I might add I am using IntelliJ and have tried to import the JAR manually as per this.
Thanks,
The OneSignal error "No valid Google Play services APK found" means that the "Google Play services" app is missing from the device or is most likely just out of date. It should check the version under Settings>Apps. It should update automatically in the background after you open the Google Play store on the device and sign in. See the following link for more details.
https://documentation.onesignal.com/docs/all-users-are-shown-as-not-subscribed
You need to add it to your project library..
File >> Import, select Android > Existing Android Code into Workspace, browse to the library project (your android sdk env) to import it. extras/google/google_play_services/
After this.. you need to open the properties for your project..
Right click on your project and click properties select android and under the library section add the google lib.

Google Play Services need to update in android studio emulator

Google Play Services need to update in android studio emulator. But if I press update nothing happens. I am using api 23.1.1. I need to use the op play services to use Google Cloud Messaging. how do you need to update?
Run SDK Manager.exe you will get a pop up of Android SDK Manager. At the bottom u will find Select New or Updates. Then you can select the updated google play services and install the package.
I fixed this issue before by changing a line in my build.gradle file
from:
compile 'com.google.android.gms:play-services:8.3.0'
to:
compile 'com.google.android.gms:play-services:7.+'

How to solve the issue with "your app will not work unless you update your google play service"?

I am having Google+ login in my app.I have done all the steps which was mentioned in this link here
The issue is when I run my app it shows "this app will not work unless you update your Google play service".Then I updated my google-play services to its latest version.
later I update the Google-API Intel x86 atom_64 system image under API-21.Still I find the same message to appear.
can't fix this issue need help.Don't know what I am doing wrong.
Check if the feature that you use really needs the latest version of google apis, you can use older versions of the google play services by adding
compile 'com.google.android.gms:play-services:6.5.87'
under dependencies in build.gradle
Try resetting app preferences. Settings>Apps>menu>reset app preferences. This sometimes helps with Play issues.
You have to import google play service from sdk->extras->google->googleplayservices->googleplayservice-lib;
Then rightclick on project -> properties ->add
add the library
to get new version go to sdkmanager->extras->googleplayservice (install or update)
if it is not available then you have to update adt tools and then it will appear.
for that use link
How can I update my ADT in Eclipse?

Google Analytics v4 in Android: Could not find class 'com.google.android.gms.analytics.Tracker'

I am desperately trying to integrate GA v4 in my Android app.
And I followed the guide here https://developers.google.com/analytics/devguides/collection/android/v4/
And integrated Google Play Services lib as described, but it gives me
Could not find class 'com.google.android.gms.analytics.Tracker
But I can find classes and its namespaces in the project.
I can't figure out what's happening here.
I followed also the instruction on Analytics for Android v4.
But additionally I had to update play services and build tools in the SDK manager. Then I had to add compile 'com.google.android.gms:play-services:8.4.0' in the app build.gradle (above of compile 'com.google.android.gms:play-services-analytics:8.4.0'. The Tracker class was still unknown (red underlined) but despite of that I pressed "Run" (install app) in Android Studio and only then analytics was recognized and could be used.
I had the same problem and the reason was my Google Play services package was outdated.
Using Eclipse, I went into Window > Android SDK Manager, checked only Google Play services package (under "Extras" in the bottom), updated it and created a new lib project.
Then I followed the steps in tutorial below to create a new google play services lib project.
https://developer.android.com/google/play-services/setup.html
Hope it helps!
/Paulo

Google Cloud Messaging for Android Library not Found in the sdk Manager

I am trying to implement a push notification solution for android.I am following the steps given in the following tutorial http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
but when i tried to install the Google Cloud Messaging for Android Library using the android sdk(i am using the latest sdk) i don't find it the extras module like you can see in this picture
This is really strange.
Is there any solution?
Select the 'Show Obsolete Packages' option in Packages menu and you will be able to view it and install.
Install Google Play Services Library
For client side implementation of GCM use this link
For server side purposes follow the tutorial
Pls note that the tutorial explains how you can send messages to individual devices using the registration id and not to all devices at one go.
[Update]
I observed that still some people are using the deprecated library - GCM for android.
"Google Cloud Messaging for Android" is deprecated and no more used.GCM API's are now available as part of "Google Play Services".
Eventhough #anubhav's answer is correct for the asked question it is not recommended.
Seems like this package is now obsolete. In order to see it in SDK Manager I had to check "Show obsolete packages" in the "Packages" menu
Edit (clarification of my answer)
I encountered this problem when trying to run Maven Android SDK Deployer. The version of the SDK deployer I used, was expecting gcm package installed (at least when running the deployer in its default configuration).
For other purposes, it's recommended to use the newer Google Play Services instead, as stated in one of the answers here.
To Add Google Play Services to Your Project (For Android Studio)
Open the build.gradle (Module:app) file inside your application module directory.
Add a new build rule under dependencies for the latest version of play-services.
For example:
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
3.Save the changes and click Sync Project with Gradle Files in the toolbar.
4.Open your app's manifest file and add the following tag as a child of the <application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
go here for more details :Setting up google play services
Is there any solution?
Use something newer than that tutorial. The old GCM API was deprecated last May and was replaced with a new one.
Just tick the "Obsolete" checkbox in Android SDK Manager popup.
the Google Cloud Messaging for Android Library is obsolete,you can find it by do this: sdk manager --> packages(left corner)-->show obsolete packages,then you will see it.but google sugessts to use Googleplay Service instead.

Categories

Resources