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'
}
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.
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!
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.
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!
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.
in my case I needed to comment out this lines in gradle
androidExtensions{
experimental = true
}
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.
I removed this code from my Gradle:
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
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
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()
There's no unique solution for this error, except that it's a syntax error inside build.gradle file.
I'm using JAVA, but for some reason Android Studio added kotlinOptions into android block without my knowledge. And then the same error happened. I put here just in case someone need it.
android {
// ...
// remove this block if you are using Java
kotlinOptions {
jvmTarget = '1.8'
}
// ...
}
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
I just removed useProguard true in build.gradle > android > buildTypes, and it worked for me.
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
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!
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
}
This problem is common in Flutter 2.8
Delete Folder with all sub Folder of C:\Users\LENOVO\.gradle
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
After if the issue is Not resolved then Second Step is:
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
add multiDexEnabled true if file size increase from limits
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!
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
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'
}
}
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 {
...
}
}
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}'
}
}
}
There is no general answer to this problem. There is just something wrong with the app/build.gradle.
In my case I defined a variable named versionCode which caused the error. Renaming it to e.g. versionCode_ fixed the problem.
Make sure you are using the kotlin android plugin instead of the kotlin jvm plugin.
apply plugin: 'kotlin-android' // NOT kotlin-jvm
I had a similar issue because I had added a trailing comma , in defaultConfig in android/app/build.gradle
Try to comment this in your app level build.gradle file
openOptions {
disable 'InvalidPackage'
}
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.
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
}
I got this problem after adding
kapt {
// etc
}
because I hadn't added:
apply plugin: 'kotlin-kapt'
I'm using Android Studio 2.1.2. I started a new project with minSdkVersion as 19. My activity extends AppCompatActivity. The project starts with an empty activity using a fragment.
When previewing content_main.xml with API 24, all is good. when previewing API 19, I get the following rendering problem:
The following classes could not be instantiated:
- android.support.v7.widget.Toolbar
java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat
I have added every thing I found relevant to the gradle (2 files):
classpath 'com.android.tools.build:gradle:2.1.2'
vectorDrawables.useSupportLibrary = true
buildToolsVersion "24.0.1"
compile 'com.android.support:appcompat-v7:24.1.1'
compile "com.android.support:support-v4:24.1.1"
compile 'com.android.support:design:24.1.1
But still the error appears. I've found a lot of answers on internet. But none helped. Is there a problem using the new toolbar with API 19?
This worked well for me
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
generatedDensities = []
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Notice this in the above code:
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
additionalParameters "--no-version-vectors"
}
and
generatedDensities = []
from this google Issue
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
check this issue for more help.
UPDATE
configured your app build.gradle file as follows
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
}
Source
Age Of Vectors
Firstly, there are two types of gradle files.
build.gradle(Project: ProjectName)
build.gradle(Module: app)
For more information on these two files, go through this answer.
Coming to your question,
I've found a lot of answers on the net but none helped. I'm using
Android Studio 2.1.2, my activity extends AppCompatActivity and added
to the gradle (2 files) every thing I found relevant: but still the
error appears.
From whatever you have posted, it seems like you didn't add right things at right places.
You shouldn't place your application dependencies in build.gradle(Project: ProjectName) - Android Studio says,
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Hence, replace your dependencies in build.gradle(Project: ProjectName) with below
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
Replace your dependencies in build.gradle(Module: app) with below
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
}
After doing as mentioned above, you will see a "Sync Now" option on the Top Right. Click it. Android Studio will take care of remaining things.
Also this question similar is to yours. Go through it. It may help.
Add :
build.gradle
defaultConfig {
...
vectorDrawables.useSupportLibrary = true
...
}
And on top of your Activity class:
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
And one last thing put your vector drawables inside any other drawables like selector, LayerList, etc. Something like below:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/drawable_vector" />
</selector>
And use this above drawable everywhere instead of setting vector drawables directly. This will at other places as well whenever you want to use vector drawables on pre-lollipop devices.
Verdant newbie here. I'm making a fairly simple project that needs to be compatible with Android versions older than Lollipop, but still want to have the app look nicer by using AppCompat.
Unfortunately, I do not know how to work (or even find) the gradle - I tried to run a gradle task: compile "com.android.support:appcompat-v7:21.0.+"
But it returned an error saying that "Task 'compile' is ambiguous...." in my project.
Could anyone tell me how to add this? I've searched all over Google, but everything goes way over my head.
Thanks!
Have you been able to locate Gradle file?
Edit your gradle like this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xyz.xyz"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.00.00"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
}
Update your question and post full Gradle code.
Add the appcomapt library(com.android.support:appcompat-v7:21.0.+") in dependancy section of the build.gradle file
Or second way to add library is by searching on maven repo.this can be done by traversing file->project structure->app>dependancy->click (+) ->add Library dependancy
Task 'compile' is ambiguous.
This issue is not the Compile Issue. but this was an issue on the task itself.
if you are not using a command like "gradle compileDebug" then one of the android configurations are executing the task and it is not working well with your build.gradle.
Here is a link that seems to relate specifically to your issue. Click Here
I'm new to android studio and had somebody write an app I made which was originally used in app inventor. I followed his template and added new things. The app has a problem with the Gradle and gives me the following.
"Error:(3, 0) Plugin with id 'com.android.application' not found."
It also says that my extras Android Support Repository isn't installed however it is. and everything is up to date. I saw many things about updating the Gradle, How do I do that if the SDK manager didn't.
code is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
applicationId "contactorganizer.introcode.or.myapplication"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
}
Sorry about not having much knowledge.
If you would like the project I can email it to you because I have absolutely no clue and would love to just build this.
Thanks for your help!
When I updated my Android Studio to the latest, I got the same problem. Here is how I solved it.
First:
Add the following code to the top of your build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Second: Find the gradle-wrapper.properties.
Change the last sentence to this:
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
Hope this works for you.
I have faced the problem too. The android plugin is 1.2.3. It appears when running one module task in the module directory like this way, ../graldew :module:xxx.
I eventually notice plugin 1.2.3 cannot get right context and android plugin 1.5 works well. So It will work to give it right gradle file.
../gradlew -b ../build.gradle -c ../settings.gradle :module:xxx
This is the situation for me. You can just regard it as a reference.
I've imported a library in Android studio (0.5.3)
My settings.graddle looks like this:
include ':app', ':libs:Android-PullToRefresh-master'
And my build.graddle looks like this:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.google.android.gms:play-services:4.2.42'
compile fileTree(dir: 'libs', include: ['*.jar'])
project(':libs:Android-PullToRefresh-master');
}
The folder I've downloaded is placed in the libs folder directly under the app folder. Also the graddle syncs and building doesn't provide any error. Yet whenever I try to import import com.handmark.xxxxxx; I get the error cannot resolve symbol 'handmark'. I've chcecked to project structure and the app has the dependency in the list.
What is going wrong and how can I fix this?
I ran into the same issue here and asked the question on the "Android Developer Tools" Google+'s community. Alex Ruiz picked up the conversation and told me:
I'm able to reproduce this issue. Unfortunately, no updates yet. We
are currently fixing the "Project Structure" (the core
infrastructure,) and we will get to this, hopefully soon.
So they are aware of it but we still have to wait until they fix it.
In the root of your project, run :
./gradlew clean && ./gradlew build
Then recompile your project in studio and you should see your new lib.
I had the exact same problem as this, however the library file was an aar file, and it happened a long time after adding the library and developing with it for a while.
Building on the information Thomas provided; I found to fix this you should replace the file dependency with a maven dependency if possible. A good resource for finding and creating your Gradle dependency is Gradle, please.
That site returns the below dependency when searching for PullToRefresh
dependencies {
compile 'com.loopeer.android.thirdparty.pulltorefresh:Android-PullToRefresh:2.1.1'
}