How to fix ERROR: No signature of method: build_ap86oam3dut3pxce3x49rdtma.android()?

AndroidAndroid StudioKotlin

Android Problem Overview


ERROR: No signature of method: build_ap86oam3dut3pxce3x49rdtma.android() is applicable for argument types: (build_ap86oam3dut3pxce3x49rdtma$_run_closure1) values: [build_ap86oam3dut3pxce3x49rdtma$_run_closure1@47588b04]

The build gradle is:

apply plugin: 'com.android.application'

    android{
    implementationSdkVersion 28
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.uiresource.taksiku"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        implementation "com.android.support:appcompat-v7:$var"
        implementation 'com.android.support:design:28.0.0'
        testimplementation 'junit:junit:4.13'
        implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta5'
        implementation 'de.hdodenhof:circleimageview:3.1.0'
        }

Android Solutions


Solution 1 - Android

If you are using kotlin version 1.4.21 or newer, kotlin-android-extension is deprecated. So if you removing the plugin you also have to remove the android experimental extension block. In my case, I had to remove these pieces of code.

apply plugin: 'kotlin-android-extensions'


androidExtensions {
    experimental = true
}

But if above did not fix it

This a kind of general and/or wrapping error which hides the real cause and/or problem, hence to see actual error message, try something like:

./gradlew :app:assembleDebug --stacktrace

>And search for resulting real error-message instead.

Solution 2 - Android

I had the same error message until I commented out everything in the android plugin except the compile sdk version, trying to get back to a successful build config.

android {
    compileSdkVersion 23
/*
    ...
*/
}

Then, I started uncommenting things until I narrowed the problem down to using the following incorrectly.

ProductFlavors {
  ...
}

I'm not sure if you're using the same block, but at the moment, I'm leaving it commented out because I'm not sure it's needed. Once I got rid of it though, I was receiving other errors about sdk root dir location, so I was able to fix those.

I hope this helps!

Solution 3 - Android

I was getting a similar error because the versionCode was being taken from a properties file, but the versionCode needs to be an integer and not a string, so toInteger() was needed.

Nice logs, android.

Solution 4 - Android

in my case I needed to comment out this lines in gradle

androidExtensions{
    experimental = true
}

Solution 5 - Android

Best thing you can do is comment parts of your build.gradle file related to the issue until you get a good build and them uncomment 1 by 1 until you find the problem. I had the same error and it was related with a typo in one of the app build.gradle blocks. I was using:

android {
    ...
    buildFeature {
        ...
    }
}

instead of

android {
    ...
    buildFeatures {
        ...
    }
}

Good luck!

Solution 6 - Android

I removed this code from my Gradle:

javaCompileOptions {
        annotationProcessorOptions {
            includeCompileClasspath true
        }
    }

Solution 7 - Android

In Android Studio 2021.1.1 Canary 12, I removed

plugins{
   ...
   id 'kotlin-android-extensions'
}

But forgot to remove this from

android{
    androidExtensions {
            experimental = true
        }
}

after removing androidExtension block my problem solved

Solution 8 - Android

This is a syntax error somewhere in your gradle file inside the android {} closure. If you are someone having this same problem then the best solution to this problem is to comment out portions of code inside android {} and keep running gradle sync until you have a successful build. Then slowly add back commented out lines until you find the culprit.

Solution 9 - Android

This issue is usually related to some change on build.gradle file, for example in my case, was this line in the defaultConfig section on that file:

versionCode 1.1

I changed it to:

versionCode 2

and problem fixed.

Solution 10 - Android

I was checking a very old project from Github and found the solution by matching the app level build.gradle file with my current project, hence the solution is to replace

runProguard false

with

minifyEnabled false

It must've been deprecated and removed in a later build which caused a similar issue - No signature of method: build_6f958jjxpxn7lllu9wu5brezx.android()

Solution 11 - Android

It is because there's syntax error in android{..} part of build.gradle You've used implementationSdkVersion which should ideally be compileSdkVersion. Error in variable names in android{..} leads to such errors.

TLDR;

Replace implementationSdkVersion with compileSdkVersion

Solution 12 - Android

There's no unique solution for this error, except that it's a syntax error inside build.gradle file.

Solution 13 - Android

This problem is common in Flutter 2.8

  1. Delete Folder with all sub Folder of C:\Users\LENOVO\.gradle

  2. Go File menu > Setting (Ctrl+Alt+S) Go Appearance & Behaviour > System Setting > Android SDK > SDK Tool Tab and then uncheck Android SDK Build-Tool press OK Button 3)Run Project (Shift+F10) in Andriod Studio it will Download all required files from the internet and your issue resolve

    enter image description here

After if the issue is Not resolved then Second Step is:

  1. Go > android\app\build.gradle in your project Please Add > minSdkVersion 19 or 20 // Remove it because, 16 is by default minSdkVersion in flutter 2.8 //minSdkVersion flutter.minSdkVersion
  2. add multiDexEnabled true if file size increase from limits

enter image description here

Solution 14 - Android

I'm new to Android but i got a message similar to yours today when i try to use a different version (not the suggested ones) of the Gradle plugin and gradle engine on Android Studio 4.1 canary.

When I had on my App build.gradle these lines:

task wrapper(type: Wrapper){
    gradleVersion = '5.6.4'
}

and on my build.gradle for the module this line

classpath 'com.android.tools.build:gradle:3.6.3' 

This was the message i got with previous settings:

A problem occurred evaluating project ':app'.
> No signature of method: build_5dcjpn4h9nkpym0yszxs5w2uh.android() is applicable for argument types: (build_5dcjpn4h9nkpym0yszxs5w2uh$_run_closure1) values: [build_5dcjpn4h9nkpym0yszxs5w2uh$_run_closure1@2e4515b3]

The way i found to solve this error was changing version for the gradle plugin on my build.gradle for the module like this

classpath 'com.android.tools.build:gradle:4.0.0' 

I hope this could help you. Happy coding!

Solution 15 - Android

I added debug under buildTypes in the gradle file and missed a comma after "API_URL":

not working:

buildTypes {
    ...
    debug {
        buildConfigField "String", "API_URL" "\"http://myapi.com/\""
    }
}

working:

buildTypes {
    ...
    debug {
        buildConfigField "String", "API_URL", "\"http://myapi.com/\""
    }
}

good luck!

Solution 16 - Android

For me I had updated firebase-crashlytics-gradle from 2.5.2 to 2.7.1 in my project build.gradle and that caused the issue.

dependencies {
    [...]
    classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.1
}

I removed an unnecessary firebaseCrashlytics configuration in my app module build.grade and then it worked again:

// TODO this entire block had to be deleted to fix the issue
firebaseCrashlytics {
    mappingFileUploadEnabled = false
}

Solution 17 - Android

I received this error while creating a new Jetpack Compose project. 'app' module's build.gradle was cracking up.

Removing packagingOptions did the trick for me ->

packagingOptions {
        
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
        
    }
}

Solution 18 - Android

I had a similar issue because I had added a trailing comma , in defaultConfig in android/app/build.gradle

Solution 19 - Android

For me, the problem was in this block

defaultConfig {
        applicationId "abc"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 12.1 **-> 13**
        versionName "3"
    }

The 'versionCode' mustn't be a decimal number

Solution 20 - Android

I had a problem similar to @LalitFauzdar 's but with a different solution. A plugin that I'm using requires custom ProGuard rules for release builds, but adding a reference to the rules file in the app gradle file resulted in the error in question. Here is the offending line, commented-out:

buildTypes {
  release {
    signingConfig signingConfigs.release
    // proguardFiles 'proguard-rules.pro'
  }
}

Solution 21 - Android

I had this error when i added 2 product flavors to my build.gradle app module file with the following names:

productFlavors {
    normal-sv1 {
    ...
    }
    normal-sv2 {
    ...
    }
}

Found out that this error was because of the '-' int the middle of the flavors' names. When i used '_' instead of '-', like below, the error was gone.

productFlavors {
    normal_sv1 {
    ...
    }
    normal_sv2 {
    ...
    }
}

Solution 22 - Android

i was trying to add parcelable plugin in my project. this was the same error in my case too. Because, JetBrains extracted the Parcelize from Kotlin Android Extensions to a new plugin, kotlin-parcelize

So, If you want to add easy parcelable in kotlin then follow these steps:

First you will need to add kotlin-parcelize plugin to your module

plugins {
    ..
    id 'kotlin-parcelize'
}

Then change your old import statement from

import kotlinx.android.parcel.Parcelize

to

import kotlinx.parcelize.Parcelize

Example:

import kotlinx.parcelize.Parcelize

import android.os.Parcelable

@Parcelize
class User(

val name: String, 
val age: Int

): Parcelable

Solution 23 - Android

I just removed useProguard true in build.gradle > android > buildTypes, and it worked for me.

Solution 24 - Android

Make sure you are using the kotlin android plugin instead of the kotlin jvm plugin.

apply plugin: 'kotlin-android' // NOT kotlin-jvm

Solution 25 - Android

I had this exact same issue. It is a nasty one.

I followed the answer first here https://stackoverflow.com/questions/61863724/deprecated-gradle-features-not-compatible and ran in the terminal

cd android && ./gradlew clean && ./gradlew :app:bundleRelease

the gradlew command gave more detialed feedback, and turned out my Java and JDK were 32bit instead of 64 and also outdated...

This resulted in further errors, but could resolve them step by step: https://stackoverflow.com/questions/58421211/invalid-initial-heap-size-xms4096m https://stackoverflow.com/questions/47291056/could-not-find-tools-jar-please-check-that-c-program-files-java-jre1-8-0-151-c

Solution 26 - Android

Try to comment this in your app level build.gradle file

openOptions {
    disable 'InvalidPackage'
}

Solution 27 - Android

In my case, the error cause is below

compilpepeeSdkVersion

rather than

compileSdkVersion

Solution 28 - Android

Thanks for mentioning to just comment things and test, for me it was:

kapt {
    useBuildCache = true
}

Removed it, everything was building again. Happened after updating Kotlin version.

Solution 29 - Android

Old issue but worth noting you might need to follow the migration guide here if you see this issue:

https://developer.android.com/topic/libraries/view-binding/migration

For me, removing the line apply plugin: 'kotlin-android-extensions' and adding view binding as below resolved the issue:

buildFeatures {
    viewBinding true
}

Solution 30 - Android

I got this problem after adding

kapt {
    // etc
}

because I hadn't added:

apply plugin: 'kotlin-kapt'

Solution 31 - Android

For me the reason was misspelling the native libs command for gradle, as of version updates and old tutorials.

    externalNativeBuild {
        ndkBuild {
            path 'Android.mk'
        }
    }

... 
// But i had:  
    externalNativeBuild {
        ndk {
            path 'Android.mk'
        }
    }

But as the number of answer indicate, there are several possibilites for this issue.
Most probably after some version updates some gradle functions are no longer available.

Solution 32 - Android

I have been struggling with the error after adding Flutter flavors. Apparently if you have flavor names which contain - it won't work.

e.g. Transformed names from test-preprod to test_preprod and it is now working.

Solution 33 - Android

For me it was useIR true inside kotlinOptions

Solution 34 - Android

Most of the time its missing dependencies, if you are using "dagger/Hilt"

  • Ensure its added in project level build.graddle
   dependencies {
       // ....
        classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
    
    }
  • add hilt plugin in the app level build.graddle
plugins {
 //....
    id 'dagger.hilt.android.plugin'
}
  • add complete hilt and dagger dependencies
   //hilt

    implementation "com.google.dagger:hilt-android:$hilt_version"

    // Dagger Core 
    implementation "com.google.dagger:dagger:2.28"
    kapt "com.google.dagger:dagger-compiler:2.28"

    // Dagger Android
    api 'com.google.dagger:dagger-android:2.35.1'
    api 'com.google.dagger:dagger-android-support:2.31'
    kapt 'com.google.dagger:dagger-android-processor:2.31'

//Dagger - Hilt
    implementation "com.google.dagger:hilt-android:2.32-alpha"
    kapt "com.google.dagger:hilt-android-compiler:2.28-alpha"

Solution 35 - Android

For me, the problem was that the Gradle Plugin update assistant replaced this:

aaptOptions {
    noCompress "..."
}

With this:

androidResources {
        noCompress '...'
}

Undoing it, solved the build error. Of course this is just a workaround.

Solution 36 - Android

Remove this line, it will work.

includeCompileClasspath true

Solution 37 - Android

Today I got this error when I was making signed apk and I made a mistake while doing setup for playstore, In android/app/build.gradle

signingConfigs{
debug{
 .....
 .....
}
release {....}  // I added the release config outside the signing config
}

Correct-way-todo-just-for-ref

Solution 38 - Android

I had mispelled signingConfig as signingConfigs

So it is actually signingConfig signingConfigs.{yourVariantName}

And NOT signingConfigs signingConfigs.{yourVariantName}

Solution 39 - Android

I had the same problem with a vanilla just-created new project in Android Studio Bumblebee (2021.1):

The auto-generated build.gradle had this in it:

buildTypes {
	release {
		minifyEnabled false
		proguardFiles
			getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
	}
}

Notice that proguardFiles "function call"'s parameters are on a separate line, this is not valid Groovy code.

Solution 40 - Android

In my case I need to remove following in app/build.gradle:

packagingOptions {
        jniLibs {
            pickFirsts += ['lib/armeabi-v7a/libc++_shared.so', 'lib/arm64-v8a/libc++_shared.so', 'lib/x86/libc++_shared.so', 'lib/x86_64/libc++_shared.so']
        }
    }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionUsman LiaqatView Question on Stackoverflow
Solution 1 - AndroidChintan ParmarView Answer on Stackoverflow
Solution 2 - AndroidDanielView Answer on Stackoverflow
Solution 3 - AndroidhtafoyaView Answer on Stackoverflow
Solution 4 - Androidmahmood View Answer on Stackoverflow
Solution 5 - AndroidBrahyamView Answer on Stackoverflow
Solution 6 - AndroidShogun NassarView Answer on Stackoverflow
Solution 7 - Androidmona baharlouView Answer on Stackoverflow
Solution 8 - AndroidDave ThomasView Answer on Stackoverflow
Solution 9 - AndroidmanuelpgsView Answer on Stackoverflow
Solution 10 - AndroidLalit FauzdarView Answer on Stackoverflow
Solution 11 - AndroidSuraj Kumar SauView Answer on Stackoverflow
Solution 12 - Androidbra.SceneView Answer on Stackoverflow
Solution 13 - AndroidMuhammad Umer YasinView Answer on Stackoverflow
Solution 14 - AndroidEnder VargasView Answer on Stackoverflow
Solution 15 - AndroidHooniView Answer on Stackoverflow
Solution 16 - AndroidOliver MetzView Answer on Stackoverflow
Solution 17 - AndroidHarisewakView Answer on Stackoverflow
Solution 18 - AndroidRaphael PinelView Answer on Stackoverflow
Solution 19 - AndroidGoWithTheFlowView Answer on Stackoverflow
Solution 20 - AndroidWillHaslettView Answer on Stackoverflow
Solution 21 - Androidmohammad reza sarsarabiView Answer on Stackoverflow
Solution 22 - AndroidMuzammil HussainView Answer on Stackoverflow
Solution 23 - AndroidSumit SaurabhView Answer on Stackoverflow
Solution 24 - AndroidcambunctiousView Answer on Stackoverflow
Solution 25 - Androidgiorgio79View Answer on Stackoverflow
Solution 26 - AndroidAmir EleuchView Answer on Stackoverflow
Solution 27 - AndroidoiyioView Answer on Stackoverflow
Solution 28 - AndroidcV2View Answer on Stackoverflow
Solution 29 - AndroidVictor UdeView Answer on Stackoverflow
Solution 30 - AndroidEdmund JohnsonView Answer on Stackoverflow
Solution 31 - AndroidHatzenView Answer on Stackoverflow
Solution 32 - AndroidGeorge DobrinView Answer on Stackoverflow
Solution 33 - AndroidMatt RobertsonView Answer on Stackoverflow
Solution 34 - AndroidFEELIXView Answer on Stackoverflow
Solution 35 - AndroidfalconforceView Answer on Stackoverflow
Solution 36 - AndroidVisal VargheseView Answer on Stackoverflow
Solution 37 - AndroidBilal YaqoobView Answer on Stackoverflow
Solution 38 - AndroidgtxtremeView Answer on Stackoverflow
Solution 39 - AndroidTWiStErRobView Answer on Stackoverflow
Solution 40 - AndroidsutherView Answer on Stackoverflow