google-play-services_lib in Android project.properties - android

i have a question relate to Android project.properties. I have no idea how to use this file. I would like to ask what does the sentence mean?
android.library.reference.1=../google-play-services_lib
Inside my Manifest file. I have a sentence as below
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
But i can not find a file called "version" which contains resource like this
<resources>
<integer name="google_play_services_version">6587000</integer>
</resources>
everything works fine after i add
android.library.reference.1=../google-play-services_lib
inside project.properties.
could anyone explain what happens? All helps are acceptable.

You must be using Google Play Services API which are published by Google.
These APIs can be accessed via library. We need to link the google play library to our project. This is done via code:
android.library.reference.1=../google-play-services_lib
or via IDE Eclipse :
Right Click on Project -> Properties -> Android tab -> Add library
So now library is linked to your project.
The meta-data in AndroidManifest.xml :
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
is defined inside the library which is linked to your project. So, the integer google_play_services_version is defined inside the library
I hope this will solve your doubt

You are working with google play services library project in your project.
When you added android:value="#integer/google_play_services_version" in your manifest it is looking for respective resource which is already in google play service lib.
You can do same by using eclipse - project properties - android - add library.

android.library.reference.1=../google-play-services_lib
* which means your using google play service liberary in your project
* project.properties file is a location for
defining the android version which you using
to build the app and the liberary reference if any.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
* This for mention the google play service version.there are different versions available

In Eclipse goto File ⇒ Import ⇒ Android ⇒ Existing Android Code Into Workspace
Click on Browse and select Google Play Services project from your android sdk folder. You can locate play services library project from
android-sdk-windows\extras\google\google_play_services\libproject\google-play-services_lib
Add the Google Play Services project as a library to your project. Right click on the project and select properties. In the properties window, on left side select Android. On the right, you can see a Add button under library section. Click it and select google play services library

Related

Can I remove com.google.android.gms.version from AndroidManifest when I use gradle?

I wonder if I can remove this line safely:
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
from my AndroidManifest.xml when I use gradle to build my APK.
According to the website https://developers.google.com/android/guides/setup only when I choose "ECLIPSE WITH ADT" I have to add this line. For "ANDROID STUDIO" usage this is not mentioned.
But in my case I use Eclipse (with ADT) as IDE but I build with gradle. (Actually it is a libGDX project). So I added the play-services by using gradle:
compile "com.google.android.gms:play-services:8.1.0"
So I run the app on a test device and I tested to login with play-services and it worked fine without having the line above in my AndroidManifest.xml
But, maybe the login just does not need the "com.google.android.gms.version" value and another part of the play services lib needs it? But I cannot test all the possible ways to use the lib.
Does anybody know for sure?
Or for those of you who use Android Studio + play services: Does your AndroidManifest.xml have the line above?
Yes, as of Google Play services 7.0 (improved in 7.5 to remove the restriction on applying to the full play-services dependency), the <meta-data> tag is automatically added to your Manifest file by Gradle via Manifest merging.

How to do a rollback from google-play-services in eclipse?

I have problems with google play services 6.5.87 and I need to rollback/install version 6.1 ( 6.1.71 or 6.1.11). How do I do that? Where can I get the files? In thh Android SDK I can't see any option for that. I use Eclipse.
I found a file version.xml in google-play-services_lib project
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="google_play_services_version">6587000</integer>
</resources>
You cannot roll back by just changing the integer, you need to specify the build you are actually using.
If you are building the google play services project, you would use this line in your manifest so that the build number is generated dynamically.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
That being said, you still need to make sure the version you are building is an version older than the one you are having problems with.
Here is a good article on how to build using a project:
http://hmkcode.com/adding-google-play-services-library-to-your-android-app/
However, if you are copying a previously built library, then you must reference the correct library in the properties of your project. Please check your settings for Eclipse / Android Studio to make sure you have added the older library. You should still use the dynamic value for the integer in your manifest, but if you insist on using a static value, you can find the integer value of the library in google-play-services_lib/res/values/version.xml
The easiest way to do this is probably to download the latest "Google Repository" via the SDK Manager. Add ${android_sdk}/extras/google/m2repository/ to your list of repositories to pull dependencies from (See "Declaring Repositories" in this). Then put your old version number back in your maven dependency declaration. (This would be if you pulled the Google Play services dependency via Maven/Ant declarations.)
You could also obviously copy the aar file out of the m2repository directory, but then you have to manually manage the dependencies and deal with class not found exceptions.

Google Play Services library loaded, referenced but still won't work, not even in sample projects?

I am trying to use the Google Play Services library for the Cloud Messaging functionality, but without any luck.
I have updated Eclipse to the latest version, and downloaded the Google Play Services lib via SDK Manager.
Imported the library into the Eclipse workspace
Referenced the library in the sample App's proprietaries
But as u can see in the images, "The import com.google.android.gms.common cannot be resolved" message appears, and none of the library commands works.
What could be wrong?
Thanks
Hi-Rez screenshot:
http://edmondvarga.com/demo/screenshot.jpg
Does your lib project look like this:
Add the Google Play services version to your app's manifest
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

How To Find Android Google Play Services Version

I'm working on an android project which requires the use of google maps. I've been reading tutorials, and I have to add this to the AndroidManifest.xml file:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
The thing is, I don't know what number to substitute the "#integer/google_play_services_version" with.
If anyone knows what I should enter there, and how to obtain that integer value, I'd appreciate it.
There is no need to subsitute. The value #integer/google_play_services_version takes care of it. Just make sure you have the latest Google Play Services library which is updated.
You can find it under google-play-services_lib>res>values>version.xml if you wish to add the number rather than #integer/google_play_services_version.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="google_play_services_version">4030500</integer>
</resources>
Here is the official guide for setting up Google Play Services in your project.
FYI, you could find the version number in this folder:
~\android-studio\sdk\extras\google\m2repository\com\google\android\gms\play-services
Enjoy.
Error you have mentioned is maybe because of not adding Google play services lib as library of your project do the following.
Select File -> Import -> Android -> Existing Android Code Into Workspace and click Next.
Select Browse, enter
/extras/google/google_play_services/libproject/google-play-services_lib, and click Open.
3.Select Copy projects into workspace and click Finish.
Mark Google Play services as a library: Right-click the google-play-services_lib project, and choose Properties > Android. Tick the Is Library option.
Right click on your project -> go to properties -> click android -> click add button -> click google_play_services_lib -> ok -> apply -> ok clean your project
this will remove your error
If you are using gradle just make sure you have the updated google play services version (downloaded using SDK manager) and put this in your project module dependency section:
compile 'com.google.android.gms:play-services:+'
IMPORTANT NOTE: In general it is not a good practice to remove the concrete version of the source you are compiling against.
I was in a case where I had to use the Froyo version of the Google Play Services, and that version doesn't require the tag. In fact, the XML entry google_play_services_version does not exist in the Froyo+ version of the Google Play Services library

Google Map API Error

<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I'm getting this error type:error:
Error: No resource found that matches the given name (at 'value' with value
'#integer/google_play_services_version').
I imported Google Map and services API into the project I'm also getting private GoogleMap map;(GoogleMap red error here)
My Project has Google APIs[Android 4.4] library but I'm still confusing :(
How can I overcome this issue?
You are referencing an resource in an xml file called integer, which is probably you didn't create, so whether you create this integer.xml and add a resource with the name google_play_services_version or you can replace the android:value="#integer/google_play_services_version" with android:value="version of you google play services as a number"
You could replace this meta-data section in you manifest file with this:
<meta-data
android:name="com.google.android.gms.version"
android:value="4030500" />
This problem is related to the Google play Service.
-- Please Note this answer is based on Eclipse IDE development environment --
+First: import Google_play_service_lip as into your workspace
I
Right click on your Package_Explorer
Import
Existing Android Code Into Workspace
Browse
Goto your Android SDK installation folder "Android-sdk"/ or whatever
/extras/google/google_play_services/libproject/google-play-services_lib
Click open
(I suggest you to check the box "Copy projects into workspace")
Finish
+Second: Now go to your project that you want to add Google Play Service to it (map in your case)
II
Right click
properties
on the left-Side Menu select Android
On the Right Side part go down to the Library section
Click Add
Select the library project "google-play-services_lib" // That you imported before.
+Now you can the the two lines to your Manifst files in your application section
<application
...// what ever activities you put here..
>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
+One last point if you still have problems try Clean your project from the Project Menu
Project - Clean

Categories

Resources