Google Play Services aar download for above 11.0.4 - android

From where to download the google-play-services aar files for version 11.6.0 OR above 11.0.4
I know just by adding the dependency in apps build.gradle adds the library in it.
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.android.gms:play-services-ads:11.6.0'
This is fair in case of Android Studio.
But as a Unity Developer, I have downloaded the Google Mobile Ads Unity Plugin which after import gives the play services ads, lite, basement, gass of version 11.6.0
Now we have some location dependency in our project. So I have downloaded the Android SDK and its stored in this path.
/Users/USERNAME/Library/Android/sdk
After navigating to /Users/USERNAME/Library/Android/sdk/extras/google/m2repository/com/google/android/gms,
I got the latest play services library of version 11.0.4 only and if I tried to create a Android Studio project by adding GPS dependency of 11.6.0, its getting added properly.
So my question is,
where google play services library of version 11.6.0 is downloaded. So that I can go to that location and get all the aar file needed for my Unity Project

Following are the details from Android developer documentation:
Programmatic access:
For programmatic access to Google's Maven artifacts, you can get an XML list of artifact groups from maven.google.com/master-index.xml (link) which gives the group path
Then, for any group, you can view its library names and versions at:
maven.google.com/group_path/group-index.xml
For example, libraries in the android.arch.lifecycle group are listed at maven.google.com/android/arch/lifecycle/group-index.xml (link).
You can also download the POM and JAR files at:
maven.google.com/group_path/library/version/library-version.ext
For example:
maven.google.com/android/arch/lifecycle/compiler/1.0.0/compiler-1.0.0.pom. (link)
For more details please refer:
https://developer.android.com/studio/build/dependencies.html#gmaven-access
For complete list of Google Play Services libraries, refer below xml:
https://dl.google.com/dl/android/maven2/com/google/android/gms/group-index.xml
Eg: To download Google Play Services Location library AAR file, use the following link:
https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/11.6.0/play-services-location-11.6.0.aar
You can replace group name, version, file, extension to download other files.
Note: Do check the pom file for each module, it may have dependencies on other Google Play Services libraries. If so, you will need to download all dependent files.
[Update]:
You can use Google's Unity Jar Resolver for this:
https://github.com/googlesamples/unity-jar-resolver

Check the links below:
play-services-ads-11.6.0
play-services-location-11.6.0

You can find and download all versions of the aar libraries at the MVN repository.
Also:
I came across a github project for Titanium/Appcelerator/AxWay. It has a script that downloads the latest play-services libraries.
The project is at: https://github.com/appcelerator-modules/ti.playservices
The relevant script is: updater/index.js
Hopefully the script will not go away because it is very useful.

Related

Create an Android Library that uses google play services

I need to create an Android Library that uses google's gcm and location services. Initially I did it inside the application's module and everything went fine.
Now I need to create an Android Library to be used by more than one app, and I'm having a lot of problems:
The first one is that my lib doesn't have a google-services.json file, since it should use the app's module to configure itself. So google play services plugin is not working on the libs' build.gradle file.
The second one is that it seems that google play services plugin detects that I'm not calling apply plugin inside the lib's build.gradle and uses by default the version 9.0.0 of the library, even when I'm configuring it to use 10.0.1. So I'm also having a strange problem to run my app, Unable to execute dex: Multiple dex files define ...
What's the right way to create an Android library that uses google-play-services which can also coexist with an Android Application that also uses google-play-services?
First of all in your library, in the build.gradle you have to remove the line
//apply plugin: 'com.google.gms.google-services'
Since you can't have a google-services.json file, you can't use the plugin.
You have to add the dependencies needed, and it is enough to compile to library.
Instead in the projects which will use the library, you have to add the plugin and the google-services.json file.
I have faced a similar situation and concluded that:
1- Android Library should have it
google-services.json
file and should also declare dependencies and google services plugin.
2- App using the library can have their own
google-services.json
file and dependencies declared.
The point to be noted here is that we should use the same versions of dependencies and google services plugin.
Also while adding library dependency,
transitive = true
is added.
I found in the internet that this error of yours is usually caused by multiple copies of library(duplicate) that you are using in your project. Go into the Project Structure -> modules, then check in the target or the apk-libs folder if there are more than one copy. After this, do a clean and build the project.
For more solution about this issue, check this related SO question.
Now, for your question about creating an Android library that uses google-play-services, try to check this tutorial if it can help you. It provides screenshot that you can follow.
For more information, check these threads:
Set Up Google Play Services
Android Studio with Google Play Services
Import Google Play Services library in Android Studio
Adding Google Play Services Library to Your Android App
Even after invalidating caches and restarting Android Studio. The only thing that solved my problem was restarting the computer. Don't know how, but suddenly everything was correct again.

APK Expansion Files: Specifying library path in Android Studio (Windows)

I am on Android Studio (Windows 10). I have been trying to follow the steps in https://developer.android.com/google/play/expansion-files.html but am stuck at the section "Preparing to use the Downloader Library". I have downloaded and installed Google Play License Library and Google Play Downloader Library. I have created the corresponding modules. But when I go to Module Settings and specify the path to the Library Repository, I get errors and when I open up Module Settings again, the Library Repository field remains blank. The error I get are :
10:23:57 PM IncorrectOperationException: Error while applying changes: cannot create file from text: C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library\
10:36:23 PM IncorrectOperationException: Error while applying changes: cannot create file from text: C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_licensing\library\
And the library repository paths I specified are :
C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library
C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_licensing\library\
I have tried various things like escaping the backslashes, importing the modules instead of clicking New Modules but to no available.
Would be grateful for any help. TIA.
The documentation of this tutorial miss the reference of the Android Manifes.xml file on the path for each android-library.
The correct path for each library are:
Google Play License Library
<sdk>/extras/google/play_licensing/library/AndroidManifest.xml
Google Play Downloader Library
<sdk>/extras/google/play_apk_expansion/downloader_library/AndroidManifest.xml
I noticed that on other tutorial from Google where use the same library for setting up the Licensing Verification Library
ANSWER UPDATED:
These previous method only reference one file of the whole library.
Actually I revert all this steps to use a library from gradle whit all we need to use Google Play License Library and Google Play Downloader Library there is the link for the repository
I tried and made it work with below Tags in individual Module's build.gradle . flatDir is the key to solution. and for Windows based Android Studio, the '\' needs to be escaped using double '\' backslashes.
repositories {
flatDir {
dirs "C:\\Users\\<username>\\AppData\\Local\\Android\\sdk\\extras\\google\\market_licensing"
}
}
I am still learning, but I think it has something to do with flatDirs container which should be child of repositories container.
it is now showing up a bit different but the Gradle Sync just works.

Extract play-services-ads jar from google-play-services 6.5+

Question:
How to extract play-services-ads.jar from google-play-services.jar ?
Background:
Since last update of google play services we may not include whole lib in our project when we need only one part of it source. The problem is that i cant add google-play-services.jar as library dependency in my project, it can be done only as file dependency. So i need somehow add only play-services-ads.jar, not the whole google-play-services.jar to avoid library method limit 65,536.
Using Android Studio, you can take advantage of the split Google Play Services libraries, ensuring you only include the part of Google Play Services necessary for what you need.
In your case, you will need to include the following AARs from AndroidSDK\extras\google\m2repository:
* com.google.android.gms:play-services-ads:6.5.87
* com.google.android.gms:play-services-base:6.5.87
And the following AARs from AndroidSDK\extras\android\m2repository:
* com.android.support:support-v4:21.0.3
Note that these are AARs and not JARs.

Import Google Play Service library to Android studio 1.0

I'm trying to implement GCM in an Android project with Android Studio 1.0.
I've installed Google Play Service library but I'm confused about ,how to import the one to project.
Does anyone know how to do it?
Thanks in advance!
Since you are using Android Studio, you are presumably also using Gradle. If this is the case, then you do not need to worry about importing any projects.
Simply open up the build.gradle in your app module, and locate the depencies {} closure.
Inside of this section, add the Google Play Services dependency like so:
dependencies {
// ...
compile 'com.google.android.gms:play-services:6.5.+'
}
Once you have done that, you can use any classes from Google Play Services anywhere in your application.
Be sure to read through the Setting up Google Play Services documentation, as you also need to include a <meta-data> element in your manifest, and you can also choose to selectively include only the parts of Google Play Services that you will be using.

Google Play Services with Maven?

I'm some kind of confused. I want to install Google Play Services for Android and found this question: How can i use google play services in a maven project?
There is a reference to https://github.com/mosabua/maven-android-sdk-deployer/ which provides a project to install a lot of mavenized APIs. So I downloaded and built it to get one of the latest Google Play Services API but when I add
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<version>5.0.89</version>
<type>aar</type>
</dependency>
to my project, I get a "support-v4-19.1.0.jar" as dependency which includes neither any Google Play Services classes nor do I have any of those layout files supplied with Google Services API. For example: When I look to https://developer.android.com/google/play-services/setup.html, and read the ProGuard part, then there must be at least a class called SafeParcelable, but this included project by Maven does not even have the common package where this class is included. I wonder what's going on here.
The project play-services-5.0.89.aar exists in the Maven repository. But how do I use this? Is there any additional task to do since it's aar or something?
[UPDATE]
Ok, it seems that's only an Eclipse problem, because com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()) is compilable by Maven although Eclipse doesn't find it. That means that the Google Play Services API works within the project.
[UPDATE 2]
Meanwhile I figured out that aar is not supported by Eclipse. But I use a little trick to use apklib and aar (which is supported by android-maven-plugin) with Eclipse. I unpack the package (in Maven repository) and import it as library into Eclipse. Then I add the library reference into the main project's properties. Eclipse finds the classes of these libraries then, so no erroneous Eclipse project anymore (even content assist works) and you can even build it by Maven when you use the android-maven-plugin. In other words: You only need to import aar and apklib as libraries into Eclipse due to code writing to not have an erroneous project. For the build process all this doesn't matter, since Maven does all your build handling.

Categories

Resources