11

I am trying to use 'ant' to build my android application. But it fails when it is building a debug version of my application. Here is the error:

BUILD FAILED /Users/michael/Programs/android-sdk-mac_x86/tools/ant/main_rules.xml:506: The following error occurred while executing this line: /Users/samuel/Programs/android-sdk-mac_x86/tools/ant/main_rules.xml:236: com.android.sdklib.build.ApkCreationException: Debug Certificate expired on 1/5/11 8:29 PM at com.android.sdklib.build.ApkBuilder.getDebugKey(ApkBuilder.java:277) at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:384) at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:247) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 

Can you please tell me how can I get a valid debug certificate?

Thank you.

1 Answer 1

25

From Android - Signing Applications:

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 365 days 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. The default storage location for AVDs is in ~/.android/ on OS X and Linux, in C:\Documents and Settings\<user>\.android\ on Windows XP, and in C:\Users\<user>\.android\ on Windows Vista and Windows 7.

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

Sign up to request clarification or add additional context in comments.

1 Comment

Further quote: "Note that, if your development machine is using a non-Gregorian locale, the build tools may erroneously generate an already-expired debug certificate, so that you get an error when trying to compile your application. For workaround information, see the troubleshooting topic I can't compile my app because the build tools generated an expired debug certificate."

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.