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
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.
I am getting this error on Android after setting up the cloud anchor quick start sample app https://developers.google.com/ar/develop/java/cloud-anchors/cloud-anchors-quickstart-android.
Here is the logcat when error occurs:
05-10 17:52:07.258 3214-3273/com.google.ar.core.examples.java.cloudanchor E/zygote64: The String#value field is not present on Android versions >= 6.0
05-10 17:52:07.528 3214-3273/com.google.ar.core.examples.java.cloudanchor E/AnchorServiceClient: AnchorServiceClient Exception
aua: PERMISSION_DENIED: The request is missing a valid API key.
at bhd.a(PG:58)
at bhd.a(PG:29)
at com.google.ar.persistence.AnchorServiceClient.a(PG:17)
at com.google.ar.persistence.AnchorServiceClient.createAnchors(PG:26)
I have:
Added app to Firebase project that contains realtime DB. Set up Rule for public.
Enabled Cloud Anchor
API, and added API key in Cloud credentials and then in manifest.
Here is a copy of the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.google.ar.core.examples.java.cloudanchor">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET" />
<!-- This tag indicates that this application requires ARCore. This results in the application
only being visible in the Google Play Store on devices that support ARCore. -->
<uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
<meta-data
android:name="com.google.android.ar.API_KEY"
android:value="**obsured**"/>
<application
android:allowBackup="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="false"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".CloudAnchorActivity"
android:label="#string/app_name"
android:configChanges="orientation|screenSize"
android:exported="true"
android:theme="#style/Theme.AppCompat.NoActionBar"
android:screenOrientation="locked">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- This tag indicates that this application requires ARCore. This results in the Google Play
Store downloading and installing ARCore along with the application.
Application code must still call ArCoreApk.requestInstall() before beginning an ARCore
sessions, in case the user uninstalls ARCore for any reason. -->
<meta-data android:name="com.google.ar.core" android:value="required" />
</application>
</manifest>
Before even attempting to do the Android version, I set up the iOS quick start sample app and that works fine - I can be a host, add an object and then resolve and find the object.
The Android version is to communicate with the same Firebase DB that iOS app did and is to demonstrate cloud anchors across iOS and Android.
I have also tried setting up the Android sample app with a new Firebase project and get the same error on Android.
If there is anyone who has tried AR Cloud Anchor for Android, please let me know why the API key is being rejected by the Google Cloud Platform while the iOS version works just fine with the same backend set up.
Thank you,
I figured out the answer to my own question.
Looks like the:
<meta-data
android:name="com.google.android.ar.API_KEY"
android:value="**obsured**"/>
...
needs to be placed within the Application element in the manifest file like this:
<application
android:allowBackup="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="false"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.ar.API_KEY"
android:value="**obsured**"/>
<activity
android:name=".CloudAnchorActivity"
android:label="#string/app_name"
android:configChanges="orientation|screenSize"
android:exported="true"
android:theme="#style/Theme.AppCompat.NoActionBar"
android:screenOrientation="locked">
...
I am new to Android Development. I have been creating an app that uses the Android Maps API. It was working well, until I updated my build tools and Android Studio. Now everytime I run it, my map is not shown, and I get the following error:
05-11 11:51:54.716 1535-1589/com.pruthvi.lanes I/OpenGLRenderer﹕ Initialized EGL, version 1.4
05-11 11:52:17.658 1535-1590/com.pruthvi.lanes E/b﹕ Authentication failed on the server.
05-11 11:52:17.658 1535-1590/com.pruthvi.lanes E/Google Maps Android API﹕ Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
05-11 11:52:17.668 1535-1590/com.pruthvi.lanes E/Google Maps Android API﹕ In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaSyA0QeeMrXpO06bvguCeF8iHFHWz3gwHrZw
Android Application (;): CC:8B:FA:E7:38:1F:A3:B6:93:A9:D7:EB:1E:2F:56:B9:F1:04:A0:FE;com.pruthvi.lanes
Here's a sample of my Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
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="AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwHrZw" />
<activity
android:name=".MapsActivity"
android:configChanges="orientation|screenSize"
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>
<activity
android:name=".LeftActivity"
android:label="Contacts" >
</activity>
<activity
android:name=".RightActivity"
android:label="Contacts" >
</activity>
<activity
android:name=".TopActivity"
android:label="Profile"
android:theme="#style/Theme.Transparent">
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
</activity>
And heres my Android Maps API file:
<resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=38:E4:08:5A:74:76:1E:21:32:DB:B2:EF:E9:3E:AD:C0:CF:15:64:73%3Bcom.pruthvi.lanes
You can also add your credentials to an existing key, using this line:
38:E4:08:5A:74:76:1E:21:32:DB:B2:EF:E9:3E:AD:C0:CF:15:64:73;com.pruthvi.lanes
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwHrZw
</string>
I have tried numerous methods to solve the problem, but nothing is working. Any help would be great. Thanks!
Fine! Solved! My fingerprint was different in both the console and logcat. Used the one from the logcat and created a key, and now its working smooth. Thanks for the help Darko. Very much appreciated.
Do you have enabled Google Maps Android API (check on this link) and check if your key is valid (this link)
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>
I want to add Google Ads (AdMob) in my application
Now I my app keeps crashing after adding it.
The logcat says:
The meta-data tag in your app's AndroidManifest.xml does not have the
right value. Expected 6587000 but found 7571000. You must have the
following declaration within the element: < meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I've added everything in the manifest
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Can someone help me fixing it?
Update your compile version of Google Play Services:
dependencies {
compile 'com.google.android.gms:play-services:7.5.0'
}