Changing API Key Has No Effect - android

In messing around, I noticed that adding a dummy API Key to a working project's AndroidManifest.xml does not affect the project. In fact, I added key "Asfasdfasdfasfa" which isn't even valid and the project continues working.
Could someone draw light on this issue? Is there caching going?
Console:
MY:SS:HA:1K:EY;com.company.myproject
MY:SS:HA:1K:EY;com.example.gmaptest
Working manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.myproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.company.myproject.MainScreen"
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="asdfadf22" />
</application>
</manifest>

Take a look of this: Can I have a single Google Maps API key for all my apps without registering their package names?.
To create an API key, you provide some information that include the package name of the app. That means you are trying to validate one of your apps with a key created with another package name, this could be the issue.

Related

IllegalStateException: meta-data tag in the AndroidManifest doesn't have a right value

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemaptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<permission
android:name="ca.sfu.cmpt276.bfraser.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="ca.sfu.cmpt276.bfraser.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The following two 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-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBR9iGtWO-bIbQ7-Fpxd8HFe9cZ53RX_Vo" />
<activity
android:name=".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>
</application>
</manifest>
Trying to figure out how Google Maps integrate with Android and Eclipse, I followed the documentation and did what I was supposed to, but I keep getting the error mentioned in the title, saying that the value isn't right, it is expecting 5089000, but is getting 0, presumably from the line
android:name="com.google.gms.version"
android:value="#integer/google_play_services_version" />
Googling this error, I've found out that most people forgot this meta-data tag, but as you can see, I put it where it's supposed to be, and I've also imported the proper library and included it in the project, but I'm still getting the error.
Anything else that might be causing this?
I've got the proper API key generated, I've downloaded Google Play Services via SDK and I don't see that I've missed any steps.
I believe it should be
android:name="com.google.android.gms.version"
not
android:name="com.google.gms.version"

Android | Google Maps API

Today I've been updating my android app but this isn't going as expected.
I'm using google maps and after the update I don't get it to work anymore.
I got another API key and everything.. Now the difference is I used Google APIs 4.2.2 and after today 4.4
Could it be that the code to display a Google Map changed in these APIs? Is there a way to keep track of the changes and if yes where?
In the old app where it works I use following code in an XML file to display a map
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_below="#id/upper"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="be.khk.mmapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<permission
android:name="be.khk.mmapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/mm_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="be.khk.mmapp.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>
<activity
android:name="be.khk.mmapp.NewsActivity"
android:label="#string/news_activity" >
</activity>
<activity
android:name="be.khk.mmapp.RetailersActivity"
android:label="#string/retailers_activity" >
</activity>
<activity
android:name="be.khk.mmapp.VoucherActivity"
android:label="#string/voucher_activity" >
</activity>
<activity
android:name="be.khk.mmapp.AboutUsActivity"
android:label="#string/aboutus_activity" >
</activity>
<activity
android:name="be.khk.mmapp.RetailerActivity"
android:label="#string/retailer_activity" >
</activity>
<activity
android:name="be.khk.mmapp.ContactActivity"
android:label="#string/contact_activity" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBnVb**************************6pUvk" />
</application>
</manifest>
If anyone could lead me in the right direction that would be nice.
The Google Maps SDK is stored in Google Play Services and is updated independently from the Android OS. What phone are you using? If you flashed a custom ROM, make sure it has Google Play Services. Can you also provide your AndroidManifest?
EDIT: check logcat for authorization failure.

Authorization Failure with Google Map API key

I am building a project for android 4.3 and building to an actual device but my google map always shows up empty and i get an authorization failure.. But everything checks out..
I have a network connection..
LOG ERROR
GOOGLE API CONSOLE
SERVICES IN CONSOLE
My Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sapientnitro.inhouse.drop"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="18" />
<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.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission
android:name="com.sapientnitro.inhouse.drop.activities.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission
android:name="com.sapientnitro.inhouse.drop.activities.permission.MAPS_RECEIVE"
android:required="false" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".activities.DRPSplashActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.DRPMapViewActivity"
android:launchMode="standard"
android:screenOrientation="portrait" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA7tcgqzYWAcqLd0ea5qAqHYpaYKTHQv5s" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
problem solved.. i had to uninstall the app, and do a project clean, then re-install the app.. don't know why exactly but now its working
Your API key in your manifest clearly does not match the API key you posted that is showing in the API console. Paste the API key from the console into the manifest. Should fix you right up.

Blank Android Google Maps v2

I know that this question is asked several times, but that didn't helped me.
When I run application on my phone, I get just blank screen with zoom in and zoom out controls.
So, here is my AndroidManifest.xml code:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<permission
android:name="com.example.testgooglemaps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="com.example.testgooglemaps.permission.MAPS_RECEIVE" />
<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-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:debuggable="true"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.testgooglemaps.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="AIzaSyDoII86zBbwgdHr8qsI0TJqtAwsVihi7N4" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Here I check path to my debug keystore.
Here is how it looks, when I check for SHA1 fingerprint from cmd.
Here is how it looks, when I am creating new Android key on Google API Console:
If map is not loading , in most cases it's because of API key issue. It seems that you have followed the procedures. I can suggest you 2 things ,
Try using a different debug or release keystore file and generate a new API ley from Google Apps API console.
Update your JDK , that will eventually update your keytool.exe . So, if it's due to keytool issue then this may help you.
Hope it helps.
I was facing the same problem one time and the solution was to downgrade the keytool.
Indeed, by changing the version I got a completely different key.
Bu I will not be able to give you the version.
On the others topics, they said to use the Keytool from jdk1.6.
Hope this will help
See here,just change the api key with your key in manifest file and follow these steps:
and make sure that generate api key with package name which is mentioned in android manifest file and your google_play_services_lib project should be present in your project's work space only.
Manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.geeklabs.map.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="replace with your API key"/>
</application>
</manifest>
MainActivity.java:
package com.geeklabs.map;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
After got this let me know.

java.lang.RuntimeException: Unable to instantiate activity Google Maps

Here is the Manifest File.
Oops! Your question couldn't be submitted because:
Your post does not have much context to explain the code sections; please explain your scenario more clearly.
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googlemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".HelloGoogleMaps"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Thanks in advance.
Here is the problem is adding permission. I also had this problem while doing a project.
You missed one permission. Find that one and give it.
You didn't supply your layout, but I had this same problem when I used the wrong Map API key in my MapView control. Under Eclipse, you must generate the Key from "debug.keystore", NOT your distribution keystore.

Categories

Resources