Android:Debug certificate expired on DATE 解决方法

 

Eclipse中编译Android工程时,提示错误 :Error generating final archive: Debug certificate expired on xxxxxx(日期)

解决办法:
进入:C:/Documents and Settings/USER(用户账户)/.android ,删除:debug.keystore和ddms.cfg



English blog

Once in a while the SDK shows some hickups – usually easy to solve. As this one. Today i got this error message “Error generating final archive: Debug certificate expired on …” while building an apk file inside Eclipse to be run in the emulator on a machine which has not been used for a while.

android debug cert error2

If you are using IntelliJ 9 with the Android plugin the error message looks like this:

android debug cert error1

Well, the idea to just update all components to the current state and then to compile a project to check it out on this backup development system went from a 10 min cruise to the unexpected question “Whats wrong?”.

Looking at the error message it was clear that the build process wanted to use a certificate which timed out. The Android SDK is using certificates to sign all the apk files even ther files which run in the emulator (fair enough). The cert is usually valid for just 365 days which means that you get the same error next time shortly after forgetting how you’d solve it last time.

The simple solution is to just delete the file “debug.keystore ” which is stored in your home directory under “~/.android ” (OSX, Linux). A Windows Vista/7  user will find the file in the “C:/Users/<user</.android folder.

android debug cert err3

After deleting the file just “clean” your project and build int from scratch and the error should be gone.

To prevent this brain training procedure for a while a decided to generate a key which lasts 1000 days instead of just the full year. Startup the OSX terminal app or the Linux terminal and go to the “.android” folder. Delete the old certificate file first. Then issue the following command from the command line:

keytool -genkey -keypass android -keystore debug.keystore -alias androiddebugkey -storepass android -validity 1000 -dname “CN=Android Debug,O=Android,C=US”

Now there should be a new certificate file sitting in the folder which lasts 1000 days – enough to really forget how you solved this issue last tim
### Vue 项目中出现 `Error: certificate has expired` 的解决方案 当在 Vue 项目中遇到 `Error: certificate has expired` 错误时,通常是因为 SSL 证书验证失败引起的。以下是详细的解决方法: #### 方法一:禁用严格 SSL 验证 可以通过修改全局配置来关闭严格的 SSL 验证功能。 对于 **Yarn** 用户: 运行以下命令以设置 `strict-ssl` 参数为 `false`[^2]: ```bash yarn config set "strict-ssl" false -g ``` 对于 **NPM** 用户: 同样可以禁用 NPM 的严格 SSL 验证,通过如下命令实现[^3]: ```bash npm config set strict-ssl false -g ``` #### 方法二:更换镜像源 如果当前使用的镜像是国内淘宝镜像(https://registry.npm.taobao.org),可能会因为其 SSL 证书问题导致错误。建议切换到官方的 npm 或 yarn 镜像源。 更改 NPM 源至官方地址: ```bash npm config set registry https://registry.npmjs.org/ ``` 更改 Yarn 源至官方地址: ```bash yarn config set registry https://registry.yarnpkg.com ``` #### 方法三:更新 Node.js 和工具版本 有时该问题是由于旧版 Node.js 或包管理器引发的兼容性问题。推荐升级到最新稳定版本的 Node.js 和对应的包管理工具(如 NPM/Yarn)。例如,下载并安装最新的 LTS 版本 Node.js[^4]。 检查当前 Node.js 和 NPM/Yarn 的版本号: ```bash node -v npm -v yarn -v ``` #### 方法四:忽略特定请求的安全警告 如果仅希望临时跳过某些请求的安全验证而不影响其他操作,可以在执行命令前加入环境变量控制。例如,在 Linux/MacOS 下可尝试以下方式绕过 SSL 验证: ```bash export NODE_TLS_REJECT_UNAUTHORIZED=0 ``` 或者直接附加到具体命令之前: ```bash NODE_TLS_REJECT_UNAUTHORIZED=0 npm install ``` 注意这种方法存在安全隐患,请谨慎使用于生产环境中[^5]。 --- ### 总结 以上提供了多种针对 `certificate has expired` 报错的有效处理手段,包括调整 SSL 设置、替换注册表以及优化开发环境等措施。根据实际需求选取合适的方式即可解决问题。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值