我很难过,因为再也看不到竹蜻蜓了。
问题描述
Android studio升级到4.0后,就无法创建Activity了,后来看到jingzz1的博客
原来是signingConfigs的写法跟之前的版本不同了,记录下来分享给需要的朋友!
错误写法
signingConfigs {
release {
keyAlias 'xxx'
keyPassword 'xxx'
storePassword 'xxx'
storeFile file('xxx')
v1SigningEnabled true
v2SigningEnabled true
}
debug {
keyAlias 'xxx'
keyPassword 'xxx'
storePassword 'xxx'
storeFile file('xxx')
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
release {
···
signingConfig signingConfigs.release
}
debug {
···
signingConfig signingConfigs.debug
}
}
解决办法
- signingConfigs模块的配置需要写在buildTypes模块之前
- signingConfigs模块里面不能出现debug之类的关键字,改个名字即可
- 修改完后,Build ---> Clean Project
正确写法
signingConfigs {
release {
keyAlias 'xxx'
keyPassword 'xxx'
storePassword 'xxx'
storeFile file('xxx')
v1SigningEnabled true
v2SigningEnabled true
}
norelease {
keyAlias 'xxx'
keyPassword 'xxx'
storePassword 'xxx'
storeFile file('xxx')
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
release {
···
signingConfig signingConfigs.release
}
debug {
···
signingConfig signingConfigs.norelease
}
}
网友评论