android 替换默认短信,替换默认Android debug keystore

使用Android Studio开发,不需要前面的操作,请转至最后

为什么替换

Android开发中,在使用第三方的sdk(如,百度地图,微信分享,友盟统计等)提供的功能时通常都要事先申请密钥,在申请密钥时需要填写keystore的数字签名(SHA1)。这样,只有使用此keystore打包生成的apk才能正常的调用这些第三方提供的功能。如果你不想在每次修改相关代码后,都要执行繁琐的验证打包安装等流程,才能测试相应得功能的话,就将此keystore替换默认keystore吧。如果你不想你团队的每一个人都要申请一个自己密钥进行调试的话,就把你的keystore分发给他们,让他们替换了吧。

修改keystore信息

想要替换默认的keystore,那么你的keystore的密码、别名等信息必须和默认debug.keystore的一样,默认debug.keystore的信息如下:

Keystore name: “debug.keystore”

Keystore password: “android”

Key alias: “androiddebugkey”

Key password: “android”

CN: “CN=Android Debug,O=Android,C=US”

重命名.keystore文件名:将自己的.keystore修改名称修改为debug.keystore(可选,只是在输入下面的命令是,将debug.keystore更换为你的keystore文件名)

修改keystore密码为“android”:键入命令

keytool -storepasswd -new android -keystore debug.keystore

按提示输入原密码,修改密码完成

修改别名为androiddebugkey:

keytool -changealias -keystore debug.keystore -alias 原别名 -destalias androiddebugkey,

按提示输入keystore密码、alias 原密码、新密码、再次输入新密码

替换IDE的keystore

Eclipse

依次选择:Window->Preferences->Android->Build->Custom debug keystore,选择你刚刚修改完成的keystore文件。

2546743bc00f

eclipse截图

)

Intellij Idea

依次选择:Project structure -> Facets ->Packaging -> custom debug keystore,选择你刚刚修改完成的keystore文件。

2546743bc00f

intellij idea截图

Android Studio(不需要进行上面的步骤)

在项目的build.gradle的中引入如下代码:

android {

//配置keystore签名

signingConfigs {

release {

storeFile file("xxxxxxxxStore")

storePassword "xxxxxxxx"

keyAlias "xxxxxxxx"

keyPassword "xxxxxxxx"

}

}

buildTypes {

debug {

signingConfig signingConfigs.release

}

release {

signingConfig signingConfigs.release

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值