I am trying to integrate Google maps in my android project. I have installed latest Google play services in my emulator and given all the necessary permissions in the manifest file. It still shows that G_services not found.
Your metadata tag is inside the tag. Remove and place it right after the application tag:
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBOhdOOMI_ZMYlvSyi7DVeRe_bo9ckxehM" />
<meta-data
android:name="android.app.searchable"
android:resource="#layout/searchable" />
</application>
Related
I want to implement Google Map in my Android app, I just follow the Google Maps Platform instruction, but it didn't work. I don't know why meta-data does not exist while I already declare it in the manifest:
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
tools:ignore="AllowBackup"
tools:targetApi="m">
<activity android:name="some.Activity"></activity>
<meta-data
tools:replace="android:value"
android:name="com.google.android.gms.version"
android:value="${MAPS_API_KEY}" />
</application>
local.properties
MAPS_API_KEY=HereIsTheSecretAPIstored
build.gradle (:app)
plugins {
id 'com.google.secrets_gradle_plugin' version '0.5'
}
service maps version:
implementation "com.google.android.gms:play-services-maps:17.0.1"
Stack trace:
Caused by: com.google.android.gms.common.GooglePlayServicesMissingManifestValueException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
at com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement##17.5.0:17)
Anyone can help me?
After some efforts, finally, I able to solve the problem with this solution:
Change meta-data and move to the top of activity tag.
From
<meta-data
tools:replace="android:value"
android:name="com.google.android.gms.version"
android:value="${MAPS_API_KEY}" />
To
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
2 Also, I forgot to enable Maps SDK for Android in Google Console, so I enable it.
So I am developing a map using Google Maps API for Android Studio. I can get a running build on my phone (Android 28.0) but it has no data on it, it's just a blank map. As soon as I start adding google services it gives me new errors.
ERROR: Failed to parse XML in C:\Users\Madzp\Desktop\MapsRedo\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[11,5]
Message: expected start or end tag
Affected Modules: app
This directs me to my manifest which edits the <application> tag with
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:hardwareAccelerated ="true"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</application>
How do I sort this parsing error as it always makes my project gradle sync fail?
Thanks,
I wanted to update my app but after uploading I noticed that there were additional permissions which I don't mention in my manifest:
android.permission.ACCESS_NETWORK_STATE
android.permission.GET_ACCOUNTS
android.permission.INTERNET
android.permission.READ_EXTERNAL_STORAGE
android.permission.USE_CREDENTIALS
android.permission.WRITE_EXTERNAL_STORAGE
com.google.android.c2dm.permission.RECEIVE
My manifest looks like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stepscience.yahtzee" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.App" >
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<activity
android:name=".StartActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
</application>
I only use the permissions for Internet and Network access. Where do the other permissions come from? In the app I use also some google play services like multiplayer and leaderboards. The only changes that I made to the version before were some version updates (gradle,play-services,appcompat) and some xml modifications.
Some permissions are being added by Google Play Services.
You can reduce the permissions it adds by only including the components that you actually need. e.g Google Cast, Google Drive etc
See here for how to do that:
https://developers.google.com/android/guides/setup
Example gradle:
Entire Play Services
compile 'com.google.android.gms:play-services:7.8.0'
Only Games Services
compile 'com.google.android.gms:play-services-games:7.8.0'
In my app i use google sample in my eclipse and use code basic map.java but when i run my app crash and down!
When I use step by step with google show map tutorial this link:
https://developers.google.com/maps/documentation/android/start?hl=pt-ZA
No problem.
My min Sdk:10 And target Sdk 19 and compile:19
my LogCat:
06-07 01:23:11.180: W /GooglePlayServicesUtil(1813): Google Play services is missing.
But I installed Google play services!
There can be two scenarios
Project must be imported google play services.
In the AndroidManifest must have
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" /> in the child of <application> tag.
Edited :
AndroidManifest.xml
<application <!-- Application Tag -->
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data <!--child of application tag -->
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAvGvbXJD4N5PC_YT2EvdcPgP9mx9YCMs4" />
<!-- activity declarations -->
<activity
android:name="com.sample.MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
</activity>
If you are using an actual device then you also need to have the Google Play Services app installed on the device. You can download it from Google Play: https://play.google.com/store/apps/details?id=com.google.android.gms
I am developing a google maps app for android.
But, somehow my application crashes giving an error like :
java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.
This is what my AndroidManifest.xml looks like:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.locations"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.locations.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAZhJllASbTnrFta8hj55shKydSi0ks824"/>
</application>
</manifest>
Log:-
01-09 12:29:35.249: E/AndroidRuntime(7448): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
I am using google maps for this app
How can i resolve this?
Missing the below in application tag of manifest. This ia new requirement as of updated google play services.
Check the topic Add the Google Play services version to your app's manifest #
https://developers.google.com/maps/documentation/android/start
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Remove this
<permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
not required
Google Map V2 add new feature in AndroidManifest.xml. You will need to add this metatag within application tag
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Try to add following meta-data tag on Manifest file it's working fine.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
As Google Map V2 use use Google Play services you need to keep it updated.
Latest google play services requires a version name, which is to be mentioned using <meta-data .. /> inside AndroidManifest.xml. This can be solved by both of the below ways_
1. Add following meta-data inside application tag of your AndroidManifest.xml
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
this value is there in your Google Play services library(res -> values -> version.xml)
2. Directly add the version code like
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
4030500 is version code which is stored inside
google-play-services_lib>res>values>version.xml
Like
<integer name="google_play_services_version">4030500</integer>
Try cleaning your project (select project>project tab>clean)
I solved my problem with this. Cleaning is the solution for most problems.
There is no need for permission:
<permission android:name="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
A tag including the google services might do the trick.
If you update your google play services you need to update your res/values tag too.
you have to add this line
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
in AndroidManifest.xml <application>