问题
Introduction
I just finished my development/debug stage of my application which uses google map .v2. It works during the development/debug stage using the key generated by google maps api, but now I wanted to release my apps on the market after I exported my apps and got the .apk file from eclipse's wizard my apps crashed the moment I tried to use google maps related functions. Android Manifest
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="**************************" />
Reference
http://developer.android.com/tools/publishing/app-signing.html
回答1:
May be you are using your system debug.keystore value ?
In development stage Use your system debug.keystore value.
In releasing stage Use your app debug.keystore value. While signing your application generated debug.keystore value.
If you want display google maps after publishing app, you must use project signing debug.keystore value and generate SH1 key.
Relesing Stage:
Steps:
1)Sign your application.
(In this time generate debug.keystore)
so use this.
2)By use this debug.keystore value generate SH1 key.
3)By use this SH1 key generate Google maps API key.
4)Paste this API key into your project manifest file.*
Development Stage:
Steps:
1)Find out our System debug.keystore value
(Window ->Preferences ->Android ->Build -> here show path)
so use this.
2)By use this debug.keystore value generate SH1 key.
3)By use this SH1 key generate Google maps API key.
4)Paste this API key into your project manifest file.*
回答2:
Add you production certificate to your google maps API key. One maps key can easily work with multiple certificates, which allows you to have one Google Maps key, and do not bother which certificate your app is currently signed with.
To assign more certificates to one Google Maps key, simply put certificate hash and package name in separate line, i.e.:
AA:BB:CC.......;com.webnetmobile.test
XX:DD:ZZ.......;com.webnetmobile.test
where AA:BB:CC... is certificate hash. One entry is for your debug certificate another for production. You can also edit current key, to add new entries, so no need to recreate.
BTW: invalid key causes no crash anyway.
回答3:
Just like what venky said: "In development stage Use your system debug.keystore value.
In releasing stage Use your app debug.keystore value. While signing your application generated debug.keystore value.
If you want display google maps after publishing app, you must use project signing debug.keystore value and generate SH1 key. "
Here are the steps I did to resolve this issue:
1) Export the project .apk, and until the final step they'll give u the SHA1 key
2) Use that new SHA1 to obtain the new key on https://code.google.com/apis/console/
3) Replace it with the one on manifest
Thats all thanks guys :
来源:https://stackoverflow.com/questions/17987374/maps-is-working-on-development-stage-but-not-release-stage