'No signature of method: .android() is applicable for argument types. Exception in build.gradle (app)
- Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'
Caused by: groovy.lang.MissingMethodException: No signature of method: build_h12dou32x8mktsbcdinr8fpc.android() is applicable for argument types: (build_h12dou32x8mktsbcdinr8fpc$_run_closure1) values: [build_h12dou32x8mktsbcdinr8fpc$_run_closure1@1630dea1]
Solution 1:[1]
I had the same issue when migrating to the AGP 7.0 when moving from aaptOptions
to androidResources
.
For me it was enough to replace
androidResources {
noCompress '...'
}
with
aaptOptions {
noCompress '...'
}
Solution 2:[2]
Best way to deal with this is going in the android { ... }
block and start commenting out different methods/blocks until the configuration moves past the .android()
error and you'll know which block is causing it. In my case it was a deprecated method in the buildTypes { ... }
block.
Solution 3:[3]
I had the same issue when migrating to the 'com.android.tools.build:gradle:7.0.0'
I removed the code:
javaCompileOptions {
annotationProcessorOptions {
arguments = [fragmentArgsLogWarnings: 'false']
includeCompileClasspath true
}
}
here is desc about how to add it again for kapt https://github.com/sockeqwe/fragmentargs#annotation-processor-options
Solution 4:[4]
In my case, there was an unwanted character(a semicolon) in build.gradle(app)
I deleted that and rebuiled the project
problem solved.
Solution 5:[5]
I was using -
(in build.gradle)
"versionCode" as RN-2 (* as i was developing in React Native)
then i tried "versionCode" as 3.1 but that also was throwing error
then i used -
versionCode 4
and this time the BUILD was SUCCESSFUL
my learning -> versionCode should be integer*
Solution 6:[6]
There's no unique answer for this, except that it's a syntax typo inside build.gradle
file.
Solution 7:[7]
I fixed this error by removing 'useProguard' from app/build.gradle like so:
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
// useProguard true <-- removed this
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
}
I hope that helps someone!
Solution 8:[8]
I recently had similar trouble. I had to rerun the project with a "build.gradle" file from another project that didn't have any issues. Then I narrowed the issue down to useProguard true
. The issue disappeared after I commented out useProguard true
as shown below:
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
//useProguard true <-- remove this line
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
debug {
signingConfig signingConfigs.debug
}
}
Solution 9:[9]
The error can have many origins. One most frequent is due to syntax typo inside build.gradle file and there's no easy way to spot it.
My suggestion. Copy the code from a working build.grade file on another project and replace the part that is throwing the error.
Solution 10:[10]
My solution was to comment all elements in android {}
section, sync & build and then uncomment. It worked.
Solution 11:[11]
I got the solution. There was a library in project having,
plugins {
id 'com.android.library'
}
in the build.gradle file of library. I added the same,
plugins {
id 'com.android.library'
}
in build.gradle file of app. It was causing this error. I changed it back to,
plugins {
id 'com.android.application'
}
This solved my issue.
Solution 12:[12]
kotlinOptions
lambda caused error in my case.
android {
...
kotlinOptions {
jvmTarget = "11"
}
...
}
When I removed it - everything start to work back again.
Solution 13:[13]
I had the same issue when I removed the id 'org.jetbrains.kotlin.android.extensions'
plugin from build.gradle(:app).
It was fixed by also removing
android {
...
androidExtensions {
experimental = true
}
...
}
Solution 14:[14]
In my case I was working with productFlavors
, setting up a boolean property. I forgot to surround the boolean value with apostrophes.
So I changed this
productFlavors {
normal {
flavorDimension "access"
buildConfigField 'boolean', 'IS_ADMIN', false
}
admin {
flavorDimension "access"
buildConfigField 'boolean', 'IS_ADMIN', true
}
}
to this
productFlavors {
normal {
flavorDimension "access"
buildConfigField 'boolean', 'IS_ADMIN', 'false'
}
admin {
flavorDimension "access"
buildConfigField 'boolean', 'IS_ADMIN', 'true'
}
}
Solution 15:[15]
I just created a new project and added dependencies, and this error occurred.
In my case the problem was namespace
'com.appName.packageName.app' line in build.gradle
file. Deleting this helped me.
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'
}
android {
namespace 'com.mathtask.app' // Delete this line
compileSdk 32
defaultConfig {
applicationId "com.mathtask.app"
minSdk 27
targetSdk 32
versionCode 1
versionName "1.0"
...
Solution 16:[16]
An absolutely Ludicrous error being issued by Android Studio
Mind you this has been compiling absolutely fine in previous versions of AS and Gradle until I upgraded a couple of days ago.
I had accidentally in one of my modules typed a Capital letter (many months ago mind you) as follows ;
DefaultConfig {
minSdkVersion 25
targetSdkVersion 30
}
After so many hours of searching and trying various things I just happened to spot it.
defaultConfig {
minSdkVersion 25
targetSdkVersion 30
}
The above resolved the issue.
DefaultConfig
-> defaultConfig
Solution 17:[17]
remove
"useProguard true"
buildTypes {
release {
minifyEnabled true
//useProguard true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Solution 18:[18]
I fix this error by changing version code to less than 6. using 7 onwards will exist this error.
Solution 19:[19]
I had this error No signature of method: build_eux4i9fuz78eb5ojbn76y01n5.android() is applicable for argument types
It was fixed by changing
buildFeatures {
dataBinding true
}
to
dataBinding {
enabled = true
}
I believe the error is the cause of version conflicts between kotlin plugin version and gradle version.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow