Android 配置打包签名信息的两种方法

发布时间:2020-09-19 03:27:28 作者:mrr
来源:脚本之家 阅读:104

目录结构如下:

Android 配置打包签名信息的两种方法

有2种方式:

第一种,直接配置:

signingConfigs { 
  debug { 
    storeFile file("app/keystore.properties") 
    storePassword "111111" 
    keyAlias "key" 
    keyPassword "111111" 
  } 
  release { 
    storeFile file("app/keystore.properties") 
    storePassword "111111" 
    keyAlias "key" 
    keyPassword "111111" 
  } 
} 
buildTypes { 
  debug { 
    signingConfig signingConfigs.debug 
  } 
  release { 
    minifyEnabled false 
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    signingConfig signingConfigs.release 
  } 
} 

第二种,通过读取文件

新建keystore.properties文件

storeFile=keyStore.jks 
storePassword=123456 
keyAlias=encrypt 
keyPassword=123456 

build.gradle配置

signingConfigs { 
  // 从keystore.properties文件中读取信息 
  def keystorePropertiesFile = rootProject.file("app/keystore.properties") 
  def keystoreProperties = new Properties() 
  keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 
  debug { 
    println("======== debug mode: set key ========") 
    storeFile file(keystoreProperties['storeFile']) 
    storePassword keystoreProperties['storePassword'] 
    keyAlias keystoreProperties['keyAlias'] 
    keyPassword keystoreProperties['keyPassword'] 
  } 
  release { 
    println("======== release mode: set key ========") 
    storeFile file(keystoreProperties['storeFile']) 
    storePassword keystoreProperties['storePassword'] 
    keyAlias keystoreProperties['keyAlias'] 
    keyPassword keystoreProperties['keyPassword'] 
  } 
} 
buildTypes { 
  debug { 
    signingConfig signingConfigs.debug 
  } 
  release { 
    minifyEnabled false 
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    signingConfig signingConfigs.release 
  } 
} 

总结

以上所述是小编给大家介绍的Android 配置打包签名信息的两种方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对亿速云网站的支持!

推荐阅读:
  1. Android开发——利用productFlavors实现一套代码打包多版本
  2. android studio 操作指南

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

android 打包 签名

上一篇:恢复已删除的邮箱帐号后登录owa报错

下一篇:Javascript 链式作用域详细介绍

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》