Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
784 views
in Technique[技术] by (71.8m points)

debugging - How Do I Create A Certificate For My Android Market APK?

I want to upload my first APK/app to the Android Market, but I got this error (which did not lead me to the correct link when searched for in stackoverflow, by the way).

Market does not accept apks signed with the debug certificate. Create a new certificate that is valid for at least 50 years. Market requires that the certificate used to sign the apk be valid until at least October 22, 2033. Create a new certificate.

Though it turns out this question is similar, the guy just says "Oh, you reminded me of how to do it" without actually explaining. I've looked at the website referred to in the "answer", but here's my problem:

  • I don't know where my keytool tool is. The Android site is pretty vague; I don't see "keytool" of any sort in my ..android-sdk-windowsools directory.
  • I think I've done this before, but I wish I had a set of steps that is like "Open up a command prompt, navigate to the directory where keytool is, enter in command 'xyz -flagsforxyz', and then point to the keystore from the 'export release apk' option in Eclipse"... or something similar.

I hope you can tell that I've tried a few things already! I might just be overlooking something simple -- so it's time for the steps to be recorded in stackoverflow! Thanks for your help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you are using Eclipse for Development just right click on your project and click export. Now choose Android and then Export Android Application. In the next step confirm the project that you want to export. Then click next and now you should be able to select create new keystore. Now fill in the required fields and your should be able to sign your app. Be sure to make a backup of the keystore file and remember your password. Losing this will make it impossible to update your application.

If you are using the terminal to create a keystore and you have Java SDK installed there should be a program called keytool in /usr/bin (on a unix based system). On Windows the SDK should also come with the keytool but the install location may be different search for keytool.exe on your computer if keytool is not in your path already. With this tool you should be able to create a key in the following way:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

Remember that once you lose your Certificate or it expires you will not be able to sign your application. Make sure that the expiration date is a long long time in the future.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...