I am trying to add google maps to my android application. On the developer website it says use this
compile 'com.google.android.gms:play-services:6.5.87'
but when i put this in it will not sync properly.... please help. Thanks in advance
First, make sure that you have the Google Repository installed in your SDK Manager. If not, then you cannot use any of the Play Services libraries.
Then, I would recommend that you use com.google.android.gms:play-services-maps:6.5.87 instead of what you have. What you have will pull in all of Google Play Services, which is rather large. The play-services-maps artifact will just pull in the Google Maps piece.
Related
I'm using Android studio to develop a Google maps app. I'm trying to test it through a online emulator. My version of Google play services is 10.2.1, the emulator uses play services 10.0.84. There is no flexibility on there end. Is there a way to add or change my google play services to match the one they are using?I looked in dependencies under project structure, but I didn't see a way to add additional services. Any help would be greatly appreciated.
Simply change your Google Play dependencies to match whatever version you feel like. Example:
compile 'com.google.android.gms:play-services-games:10.2.1'//Replace 10.2.1 with 10.0.84 or whatever version you want
This is an example using play-services-games, but you can either use the full library or each individual dependency. It will work, as long as you change ALL the dependencies using play services to the same version
I want to check out the new Awareness API which is quite new. I’m using Play Services 9.0.2. The documentation has this example:
GoogleApiClient client = new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.build();
client.connect();
However, there is no hint which dependency needs to been added. Any idea?
I found it out: I need to upgrade to PlayServices 9.2.0 and the dependency is hidden in play-services-contextmanager. Just add those dependencies and here we go:
compile 'com.google.android.gms:play-services-awareness:10.2.4'
Please use the latest play services library, at the time I updated this answer it was 10.2.4
If you want to know the latest Dependency you can use my web tool called DependencyLookup.
Keep in mind that this library was added in the Play Services Repository v31. Make sure that you have at least that version installed in the SDK manager.
You need to add the library of Google Play services to your project.
Set up Google Play services
To access the Awareness API, your app's development project must
include Google Play services. Download and install the Google Play
services component via the SDK Manager and add the library to your
project. For details, see the Android guide to setting up Google Play
services.
Source
Set up Google Play services
To access the Awareness API, your app's development project must include Google Play services. Download and install the Google Play services component via the SDK Manager and add the library to your project. For details, see the Android guide to setting up Google Play services.
which is apparently on the same page you got your code sample from here
Most of the times the number of method references in your app exceeds the 65K limit, your app may fail to compile. So in order to mitigate this problem when compiling your app ,specify only the specific Google Play services APIs your app uses, instead of all of them.
compile 'com.google.android.gms:play-services-basement:9.2.0'
compile 'com.google.android.gms:play-services-contextmanager:9.2.0'
You will find the complete solution here:
http://xordroid.com/create-intelligent-apps-with-google-awareness-api/
Starting PlayServices v9.6.0, contextmanager has been changed to awareness
So, the previous answers won't be working.
The correct dependencies, as of v10.2.4 are
compile 'com.google.android.gms:play-services-basement:10.2.0'
compile 'com.google.android.gms:play-services-awareness:10.2.0'
What´s the point of Google Repository package that just updated to revision 18?
What need that?
Google Repository is a Maven repository and the Gradle plugin automatically add it to your list of repositories.
It is necessary if you want to use Google Play Services in Android Studio:
dependencies {
...
compile 'com.google.android.gms:play-services:7.3.0'
}
All your support packages, Google play services libraries will be loaded locally from the Google Repository and it is necessary to update it to the latest version to have the latest play services in your library
To add on to the other answers, the main reason for it is that Google's lawyers require you to accept the click-through terms of service before letting you use those libraries. Otherwise, they'd probably put them up on Maven Central or wherever the cool kids keep their libraries these days.
With the local Google Repository, you can still include and access their libraries as if they were on one of those usual sites, but it keeps the legal squad happy.
I have downloaded a demo project of GSM services.
For using it, I need to install a file name Google could messaging but, it is missing from my SDK.
How can I add this file to my SDK?
New To Android
If you use GCMS (Google Cloud Messaging Services), you need to build a library project which uses Play Services and import it into your work-space.
Generally:
Install the Android SDK from this link.
Download and configure the Google Play services SDK, which includes the Google Maps Android API. You can see the setting up on this link.
Don't forget to add the required Google Play services settings in your application's manifest.
When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library. Simply adding .jar file to your project won't work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly.
You can get the full instructions from Setting Up Google Play Services.
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.