Fixed
Status Update
Comments
so...@google.com <so...@google.com>
so...@google.com <so...@google.com> #2
See PsAndroidModule.validate*Name()
xo...@google.com <xo...@google.com> #3
Thank you for the report. I've been working on improving Studio's correctness regarding Gradle DSL syntaxes, and the new behaviour is:
- the PSD disallows use of a small set of characters in names of buildTypes (and similar);
- all other names, including debug-custom, get appropriately quoted when written to the build file.
This will be available in the upcoming 4.1 Canary series, and eventually in the Android Studio 4.1 release.
- the PSD disallows use of a small set of characters in names of buildTypes (and similar);
- all other names, including debug-custom, get appropriately quoted when written to the build file.
This will be available in the upcoming 4.1 Canary series, and eventually in the Android Studio 4.1 release.
Description
In project structure > Build Variants > Build Variants > Build Types, you can hit the '+' button to add a new type.
If you enter one with a hyphen (e.g. debug-custom), it generates invalid gradle code in your build.gradle:
buildTypes {
debug {
}
release {
}
debug - custom {
}
}
And prints the following error in the build output:
Could not find method minus() for arguments [BuildType_Decorated{name=custom, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}] on BuildType_Decorated{name=debug, debuggable=true, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=SigningConfig_Decorated{name=debug, storeFile=/usr/local/google/home/ccraik/.android/debug.keystore, storePassword=android, keyAlias=AndroidDebugKey, keyPassword=android, storeType=jks, v1SigningEnabled=true, v2SigningEnabled=true}, embedMicroApp=false, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.
Open File
Suggest disallowing invalid characters in that input field.