AndroidStudio在gradle文件中修改debug签名为正式签名

来源:互联网 发布:好运来返奖统计软件 编辑:程序博客网 时间:2024/06/12 01:33

简介

在开发中有时需要在debug模式使用正式签名,比如微信的支付功能必须需要正式签名,将debug签名配置为正式签名,然后就可以开心的run了,再也不用担心run起来一些以签名作为授权的sdk无法正常使用!

步骤

  • 将keystore拷入项目目录下供gradle配置使用
  • 在signingConfigs中配置签名密码
  • 在buildTypes中使用已经配置好的signingConfigs

代码

 signingConfigs {        release {            storeFile file("yourkeystore.jks")//keystore的路径            storePassword "你的keystore密码"            keyAlias "你的别名"            keyPassword "你的别名密码"            }         debug {            }    }    buildTypes {        release {            signingConfig signingConfigs.release            minifyEnabled true//启动代码混淆             zipAlignEnabled true//Zipalign优化            shrinkResources true// 移除无用的resource文件            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }        debug {            signingConfig signingConfigs.release        }    }
1 0