When the activity and fragment are automatically created, the build fails, and the creation is unsuccessful, and there is no prompt. After querying the information, I found that the writing of signingConfigs is somewhat different from the previous version. After the modification, it returns to normal.
The build.gradle file under the module, if you need to configure the signingConfigs module, then there are two rules to follow
1. The configuration of the signingConfigs module needs to be written before the buildTypes module
android {
……
signingConfigs {
……
}
buildTypes {
release {
……
}
debug {
……
}
}
}
If you write it out of order, it will report Could not get unknown property'xxxxxxx' for SigningConfig container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer error
2. Keyword such as debug cannot appear in the signingConfigs module
//错误写法
signingConfigs {
debug {
storeFile file('key地址')
storePassword "密码"
keyAlias "Alias名称"
keyPassword "密码"
}
}
buildTypes {
debug {
……
signingConfig signingConfigs.debug
}
}
//正确写法,把signingConfigs模块里的 “debug ”改成其他名字,例如改成sbGoogle
signingConfigs {
sbGoogle{
storeFile file('key地址')
storePassword "密码"
keyAlias "Alias名称"
keyPassword "密码"
}
}
buildTypes {
debug {
……
signingConfig signingConfigs.sbGoogle
}
}
After modification, remember to delete the output.json file in the build folder of the project