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
Related
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
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.
I am new to Android and want to embed Google Maps v2 to my application, but can anyone please tell me which dependencies should I install on phone or include to project?
Include Gradle dependency:
dependencies {
implementation 'com.google.android.gms:play-services-maps:16.1.0'
}
You may found Gradle, please helpful. Also, check out this page for Android APIs releases.
I assume you have already read https://developers.google.com/maps/documentation/android/ :-)
In short:
you need to download and install the Google Play service lib via SDK manager
create a project in Eclipse via "Create project from existing source code" and use the source code from "\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib"
add this project as dependency to your actual project via right click on your project -> properties -> android -> add project library
add the permissions as described in the link mentioned above
request an API key as pointed out in the link above as well
add a SupportedMapFragment to your layout
you need an active Google account on the device to will test your map (it will install the required dependencies on the device automatically then)
That's it :-)
Hope that helps....
I am writing a MAP APP using Android Google Maps V2
But i am facing dependency problem, please see below images:
as you can see in above screen shot i am getting RedAlert Sign over Project Name
and as you can see in above screen shot getting RedCross over Android Dependencies
#ChulbulPandey
In Eclipse open Project -> Properties. Select Android on left. Check on the bottom that you have a reference to Google play services with a green checkmark. If not, click Add and add the google play services library
Path of google-play-services_lib at SDK;
\extras\google\google_play_services\libproject\google-play-services_lib
I am not sure but you can try this.
In Libraries tab remove the Google Maps V2 jar and add it again.
First, try changing project build target to something higher and then clean then build your project.
If that doesn't solve your issue then removing your external jar files linked and then import it again.
You must import google-play-services_lib library project from SDK and add a dependency to it from your project.
Path of google-play-services_lib at SDK;
\extras\google\google_play_services\libproject\google-play-services_lib
See link
I already tell project use libraries com.google.android.maps in the manifest of project but in my activity it shows errors about importing com.google.android.GeoPoint. and others.
which target version you are using? use target Google apis 1.6 instead of android. You can the change the target version from project itself.
1.Right click on the project
2. choose Build path--> Configure Build path
3.Window will be opened, choose Android in right corner of the window then change target version in to Google apis.
Based on the short described question, i can assume below:
Yes you have mentioned it inside the AndroidManifest.xml file but have you choosen the library instead of SDK while creating android application. If no, then you just need to select Google API (Google Inc.).
You can mention it on the AndroidManifest.xml but first of all choose google api sdk.
First you have to make sure you have installed Google API
Then set your project's properties in Eclipse to check off the Google APIs version of the SDK.
and Make sure you have include this library in AndroidManifest FIle
<uses-library
android:name="com.google.android.maps" />
//in AndroidManifest.xml >>uses-library android:name = "com.google.android.maps"/>
then add maps.jar search for maps.jar and coppy path in your computer
example:C:\Users\android\sdk\add-ons\addon-google_apis-google-17\libs\maps.jar
then right click on your projects >>Build Path >> Configure Build Path..>>Java Build Path>>Libraries taps >>Add External jars..>>past path:C:\Users\android\sdk\add-ons\addon-google_apis-google-17\libs\maps.jar>>choose maps.jar click ok..ends thank you.