【Android studio】4.0无法自动创建activity,fragment

需在App下的build.gradle进行如下配置
1.signingConfigs的配置需要写在buildTypes模块之前
如果不按顺序写,会报Could not get unknown property 'xxxxxxx' for SigningConfig container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer的错误
2.signingConfigs里面不能出现debug之类的关键字

正确写法如下

signingConfigs {
        newrelease {
            keyAlias 'xxx'
            keyPassword 'xxx'
            storeFile file('xxx')
            storePassword 'xxx'
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.newrelease 
        }
        debug {
            signingConfig signingConfigs.newrelease 
        }
    }

你可能感兴趣的:(【Android studio】4.0无法自动创建activity,fragment)