WEB开发网
开发学院手机开发Android 开发 Android 签名证书 阅读

Android 签名证书

 2010-04-12 15:53:00 来源:WEB开发网   
核心提示:to use Jarsigner to sign the .apk with your own key before distribution. If you don't have a key, you can use Keystore to create a keystore and key with all
to use Jarsigner to sign the .apk with your own key before distribution. If you don't have a key, you can use Keystore to create a keystore and key with all the appropriate fields. If you already have a key, such as a corporate key, you can use that to sign the .apk.

Signing in Ant

If you use Ant to build your .apk files, debug signing mode is enabled by default, assuming that you are using a build.xml file generated by the activitycreator tool included in the latest SDK. When you run Ant against build.xml to compile your app, the build script generates a keystore/key and signs the .apk for you. No specific action on your part is needed.

To compile your application in release mode, all you need to do is specify a build target "release" in the Ant command. For example, if you are running Ant from the directory containing your build.xml file, the command would look like this:

ant release

The build script compiles the application .apk without signing it. After you have compiled the.apk, you need to use Jarsigner to sign the .apk with your own key before distribution. If you don't have a key, you can use Keystore to create a keystore and key with all the appropriate fields. If you already have a key, such as a corporate key, you can use that to sign the .apk.

Expiry of the Debug Certificate

The self-signed certificate used to sign your application in debug mode (the default on Eclipse/ADT and Ant builds) will have an expiration date of 1 year from its creation date.

When the certificate expires, you will get a build error. On Ant builds, the error looks like this:

debug:

[echo] Packaging bin/samples-debug.apk, and signing it with a debug key...

[exec] Debug Certificate expired on 8/4/08 3:43 PM

In Eclipse/ADT, you will see a similar error in the Android console.

To fix this problem, simply delete the debug.keystore file. On Linux/Mac OSX, the file is stored in ~/.android. On Windows, the file is stored in C:Documents and SettingsLocal SettingsApplication DataAndroid.

The next time you build, the build tools will regenerate a new keystore and debug key.

上一页  1 2 3 

Tags:Android 签名 证书

编辑录入:coldstar [复制链接] [打 印]
赞助商链接