I've had the following code in my build.gradle (app) file for a while:
signingConfigs {
release {
storeFile file("D:\\Android\\keystore\\myApp.jks")
storePassword "myStorePw"
keyAlias "myKeyAlias"
keyPassword "MyKeyPw"
}
}
I've just upgraded to targetSdkVersion=22, which meant upgrading SDKs and build tools to 22 as well. Now that whole section is highlighted in yellow in Android Studio (141.1793788) with the message:
'signingConfigs' cannot be applied to '(groovy.land.Closure<com.android.build.gradle.internal.dsl.SigningConfig>)'
Has there been a change in v22 that I need to know about? I can't find documentation.
Please try to move your signingConfigs section higher, just below: compileSdkVersion and buildToolsVersion. Example below:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
signingConfigs {
release {
storeFile file("D:\\Android\\keystore\\myApp.jks")
storePassword "myStorePw"
keyAlias "myKeyAlias"
keyPassword "MyKeyPw"
}
}
}
As @GDanger asked for the reason; So the reason is simple. When you define a variable in gradle script, keep that in mind, It should not be used before its definition.
I am pretty much sure that OP has defined the signingConfigs below buildType config. And because of that he is getting that warning message.
Let's do an experiment to understand; write below code in your gradle script:
def A = B;
def B = "I am test."
You'll see this error when you syn with gradle:
Error:(3, 0) Could not find property 'B' on project ':app'.
<a href="openFile">Open File</a>
But when you define it like this:
def B = "I am test."
def A = B;
You'll not get any error. So I am sure trying this small experiment would make you understand that how compiling in gradle script works. Hope this will help. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With