我是靠谱客的博主 笨笨奇迹,这篇文章主要介绍Android 配置打包签名信息的两种方法,现在分享给大家,希望可以做个参考。

目录结构如下:

有2种方式:

第一种,直接配置:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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文件

复制代码
1
2
3
4
storeFile=keyStore.jks storePassword=123456 keyAlias=encrypt keyPassword=123456

build.gradle配置

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 配置打包签名信息的两种方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对靠谱客网站的支持!

最后

以上就是笨笨奇迹最近收集整理的关于Android 配置打包签名信息的两种方法的全部内容,更多相关Android内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(146)

评论列表共有 0 条评论

立即
投稿
返回
顶部