Android - What´s the point of Google Repository package - android

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.

Related

How to check available libraries and version numbers from https://maven.google.com

Ever since Google hosted its libraries in the new Google Maven Repository I'm having trouble keeping my dependencies up to date.
How can I check which libraries are availalbe in maven.google.com? In addition how can I see all the available version numbers of a particular library if I can't just browse the https://maven.google.com URL?
Any alternatives apart from navigating to https://developer.android.com/studio/build/dependencies.html#google-maven
And checking the Website every time?
Seems that my prayers have been heard. You can now browse
https://maven.google.com and check available libraries and version numbers.
Related post here https://plus.google.com/+IanLake/posts/gJ4SuhDhpgC

Adding older Google Play Services to Android Studio

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

Which dependency is required for Awareness API?

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 to add to my build.gradle for google maps

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.

Check-in Android project having dependencies to SVN

I have added google play services lib as a dependent library to my Android project as shown.
I need to checkin the code to SVN . Do i need to checkin the google play services project as well? Or Is there any way i can package the google play services project along with my Android project?
Any help will be appreciated.
The Google Play Services should be used as an Android Library Project. So you shouldn't pack it in any way. Usually I don't like committing external libraries in the versioning control system, and I prefer letting everybody clone and import the library projects locally. You could though add the library project into a different folder, and commit it to your source control if you find it more convenient.
Another alternative would be to use Maven for dependency management.

Categories

Resources