可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have finally created a 'final' keystore for my app. As my app is using Google Maps, I take I have to update all Layouts to use the new API Key resulting from the app as well..
Now I'm fully aware of the requirement to export a signed APK for release, but what after that? My thoughts are that for further development and testing, it would be easiest if I could configure Eclipse to use my final keystore instead of the debug keystore … but I found no way to do that? It only allows me to configure an 'alternative' debug key but I guess that's not the same.
Sorry if I am too confused if I have totally misunderstood something here.
回答1:
I was able to to use my Google Play release keystore as my custom debug keystore to help with debugging in-app purchase functionality. The same could no doubt be applied to debugging Google Maps stuff as well.
As Devunwired mentioned, there are caveats. But my solution was this:
- Copy your release key somewhere.
- Change the keystore password/key password and key alias following the instructions here (also, following Devunwired's recommendations to make it look like a debug keystore).
- Change Eclipse's Preferences > Android > Build > Custom keystore setting to the path of the copy made in step 1.
- Done!
回答2:
You can configure a custom keystore to use for your debug builds (the ones that happen when you click Run...) in Eclipse by going to Preferences -> Android -> Build and entering the file name in the "Custom debug keystore" option.
However, it has the caveat that it must follow the same rules as a traditional debug keystore, mainly:
- The keystore password must be "android"
- It must contain a key named "androiddebugkey"
- That key's password must be "android"
Therefore, while it is possible to sign your apps in debug with the same keystore as you Export with, it requires your production keystore to look like a debug store, which makes it less secure if someone got ahold if the file (it would be easier to inspect and guess the passwords).
HTH
回答3:
In order for Eclipse to sign automatically for you when you deploy you need to set up a keystore which behaves like the debug keystore. This means there must be an 'androiddebugkey' and both the key and keystore password must be 'android'. Therefore, I'd recommend the following:
- Make a copy of your keystore, I copied mine to a file called iap.keystore
- Open terminal/command window with keytool on the path (for me the path is D:\NVPACK\jdk1.6.0_45\bin\keytool.exe) or use the fullpath to
keystore
in the commands below
- Change your keystore password to 'android':
keytool -storepasswd -keystore iap.keystore
- Follow prompt to enter your old keystore password
- Follow prompt to enter
android
as the new password
- Follow prompt to confirm
android
as the password
- Rename your key to
androiddebugkey
(replace Old_Key_Store_Name
with your current key name in the next command)
keytool -changealias -keystore iap.keystore -alias Old_Key_Store_Name -destalias androiddebugkey
- Follow prompt to enter your keystore password (which is now
andorid
)
- Follow prompt to enter your
Old_Key_Store_Name
password (this is whatever you previously had your key password set to)
- Change the password for your
androiddebugkey
keytool -keypasswd -keystore iap.keystore -alias androiddebugkey
- Follow prompt to enter your keystore password (which is now
andorid
)
- Follow prompt to enter your
androiddebugkey
password (this is whatever you previously had your key password set to)
- Follow prompt to enter
android
as the new key password
- Follow prompt to confirm
android
as the key password
- You now have a keystore (with key) which Eclipse can use to automatically sign builders.
- Load up Eclipse.
- Window -> Preferences -> Android -> Build
- Follow 'Custom debug keystore' browse to the iap.keystore file we previous created
- OK
Now when you launch/debug your project, it'll use the keystore we just set up to sign your project. This will allow things like IAP to work.
BEWARE: this is convenient, but of course if someone gets hold of your iap.keystore they will be able to sign things as you by using 'android' as the keystore/key password. Hopefully this is obviously from the steps listed above, but just take a second to appreciate what this means for yourself (or your company). Then based on that decide if the risks are acceptable, and if you need to carry out any extra measures to ensure the safety of this file.
回答4:
We set custom keystore to use for our debug builds. Eclipse Go to Preferences -> Android -> Build and ent the file name in the "Custom debug keystore".
Important when we create our keystore for eclipse customs.:
The keystore password must be "android"
It must contain a key named "androiddebugkey"
That key's password must be "android"
Therefore, while it is possible to sign your apps in debug with the same keystore as you Export with, it requires your production keystore to look like a debug store, which makes it less secure if someone got ahold if the file (it would be easier to inspect and guess the passwords).
if we want to change the keystore password: $
keytool -storepasswd -keystore my.keystore
if we want to change the keystore alias password: $
keytool -keypasswd -keystore my.keystore -alias my_name
if we want to change the keystore alias: $
keytool -changealias -keystore my.keystore -alias my_name -destalias my_new_name
Vkj
回答5:
Here there are the instructions to convert a regular keystore in a debug keystore:
https://stackoverflow.com/a/15754187/917362
回答6:
You can enter both your debug and your release SHA1 for the same Google API key using the Google Developers Console (console.developers.google.com).
This way, you will have the same API key for both and will no longer have to change it in the AndroidManifest.xml.
回答7:
We have the same problem some time ago at our office. Since we needed this quite often we wrote a simple script to make it easy to to convert release keystores to debug ones.
The script is available on https://github.com/IntellexApps/key2debug
We are using it for some time now, so should be quite stable.
cheers!