Reputation: 258
I got this error after trying to run a Kotlin application through Android Studio:
A problem occurred evaluating project ':app'.
> No signature of method: build_4blexxmb1pl0fsds689m8rkwz.android() is applicable for argument types: (build_4blexxmb1pl0fsds689m8rkwz$_run_closure1) values: [build_4blexxmb1pl0fsds689m8rkwz$_run_closure1@220b09f3]
The error points me to this section of the build.gradle:app
file (specifically, the line with android {
):
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
buildFeatures {
viewBinding = true
defaultConfig {
applicationId "com.example.bitfighter"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildReleases {
viewBinding = true
}
What does this error message mean, and what can I change to fix the issue?
Upvotes: 4
Views: 16267
Reputation: 832
I comment this line and its working:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
minifyEnabled false
shrinkResources false
useProguard false
//signingConfig signingConfigs.debug
}
}
Upvotes: 0
Reputation: 389
Try to structure the code like this
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.bitfighter"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding = true
}
The defaultConfig should always only be in the android
clause and not inside the buildFeatures. Other than that, you don't need a buildReleases clause when you already have added a buildFeatures clause.
Upvotes: 6