“Plugin with id 'com.android.application' not found” - android

I am getting “Plugin with id 'com.android.application' not found”. I have updated the gradle distribution version in gradle wrapper properties but to no avail. Do I need to write the build gradle dependencies somewhere?

You have to add in your top level file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}

Related

Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task

I've checked this answer:
https://stackoverflow.com/a/34834772/13519865
It tells us to remove this line
apply plugin: 'com.google.gms.google-services'
Removing the line as asked completes the build, but I can't use Firebase (ofc!), it caused a new error, which tells me to add the line:
https://stackoverflow.com/a/40085096/13519865
So, I'm stuck in a loop here.
Related code sample added here https://github.com/Cyberavater/A.Reader
This issue started after updating the com.android.tools.build:gradle to version 7.3.0 and was fixed for me after updating the com.google.gms:google-services to version 4.3.14.
Edit: 2023-01-04
I have seen the same issue with the latest Android Studio Dolphin release, where you need to specify the Gradle version to be 7.3.1 and Google Services 4.3.14.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
dependencies {
classpath 'classpath "com.google.gms:google-services:4.3.14'
}
According to the new Chipmunk update of Android Studio, if you need to use Google Services, you have to add the following lines of code inside your build.gradle (Project) file:
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'com.google.gms.google-services' version '4.3.14' apply false 👈
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside your build.gradle (Module) file, the following plugin IDs:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' 👈
}
change this line in >> android/build.gradle
classpath 'com.google.gms:google-services:4.3.10'
to
classpath 'com.google.gms:google-services:4.3.14'
Read this if Alex Mamo's answer does not solve the problem for you.
The new updates of Android Studio prioritize or prefer the settings.gradle file above build.gradle(project) for plugin management. There are two possible solutions.
Solution 1. Update your existing project as follows.
Update your settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
gradlePluginPortal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"}
}
}
rootProject.name = "Your App Name"
include ':app'
Update your build.gradle(project). Use your Gradle version, this example uses version 7.3.0, and google-services: 4.3.14.
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'com.google.gms.google-services' version '4.3.14' apply false
// other plugins in build.gradle(project)
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add this to your build.gradle(app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
// other plugins
}
Solution 2. You can create a new project and move all your classes and XML into the new project.
I was facing the same issues but after updating the dependency the issues were resolved.
in my project level Gradle file previous it was as below:
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.google.firebase:perf-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
after updating as below, It was working fine with me.
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath 'com.google.firebase:perf-plugin:1.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Try with deleting .idea and .gradle folders from root of your app , an then from main app module ... If this doesn't work , then you must clone your project, making new one with same package name ... This is bug in Android Studio Dolphin , and I solved it with cloning with new project with same package name
First check your build.gradle(project) and paste these code below the plugins and also sync your project.
task clean(type: Delete) {
delete rootProject.buildDir 😊
}

Failed to update the android gradle plugin 3.5.0

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
//classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:firebase-plugins:2.0.0'
/*classpath 'com.google.gms:google-services:3.2.1'
classpath 'com.google.firebase:firebase-plugins:1.2.0'*/
classpath 'com.google.guava:guava:24.1-jre'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
flatDir {
dirs '../libs'
}
google()
maven { url "https://jitpack.io" }
}
tasks.withType(JavaCompile) {
options.incremental = true
}
}
ERROR: Gradle DSL method not found: '19.0.0()'
Possible causes:
The project 'Rightrend-20190527-2051' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.0 and sync project
The project 'Rightrend-20190527-2051' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
I fix this error by adding this line to .gradle file (app)
Gradle DSL method not found: 'kapt()'
Possible causes:
The project 'Isfahan Metro' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.3 and sync project
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' // add this
for your problem check this link.
https://stackoverflow.com/answer
move google() above.
Open your gradle-wrapper.properties file, and update distributionUrl to https://services.gradle.org/distributions/gradle-5.4.1-all.zip
This is the wrongful line, because Guava is not a Gradle plugin:
classpath 'com.google.guava:guava:24.1-jre'
In "classpath" alter for "implementation" (update your dependencies):
dependencies {
implementation'com.android.tools.build:gradle:3.5.0'
//implementation'com.android.tools.build:gradle:3.2.0-alpha09'
implementation'com.google.gms:google-services:4.3.2'
implementation'com.google.firebase:firebase-plugins:2.0.0'
/*implementation'com.google.gms:google-services:3.2.1'
implementation'com.google.firebase:firebase-plugins:1.2.0'*/
implementation'com.google.guava:guava:24.1-jre'
}

unknown property 'LibraryVariants' in build.gradle

I have the error below in build.gradle at this line:
apply plugin: 'com.google.gms.google-services'
Error:(56, 0) Could not get unknown property 'LibraryVariants' for object of type com.android.build.gradle.LibraryExtension.
It happened after I installed Firebase.
How to solve this?
The error message, Error: Could not get unknown property 'LibraryVariants' for object of type com.android.build.gradle.LibraryExtension, indicates that this plugin needs to be applied to a module which uses the com.android.application plugin.
So, the simple solution is to only include the google-services plugin in your application module and not your library module:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
I had the same problem and solved it updating gradle and google-services versions.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add the following to the #project level gradle file:
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:3.0.0'
Add the following to the #app level gradle file:
// Dependency for Google Sign-In
compile 'com.google.android.gms:play-services-auth:9.4.0'
Apply plugin
apply plugin: 'com.google.gms.google-services'

Error:The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed

I get the above error when I updated Android Gradle plugin to version 2.3.0 and Gradle to version 3.3.
Here is my Gradle script 1:
buildscript {
repositories {
jcenter()
maven { url 'example.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
subprojects {
repositories {
jcenter()
mavenLocal()
}
version = '3.4.0'
group = 'com.journeyapps'
apply plugin: 'android-sdk-manager'
ext.androidBuildTools = '23.0.2'
ext.androidTargetSdk = 23
ext.zxingCore = 'com.google.zxing:core:3.2.1'
}
Remove this line from gradle file
apply plugin: 'android-sdk-manager'
This one work for me.
Try this SDks:
https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip (form mac), https://dl.google.com/android/repository/tools_r25.2.3-windows.zip (for windows).
Reference: https://stackoverflow.com/a/42552342/1214902
Try to remove this line
apply plugin: 'android-sdk-manager'

Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found in android

I use the following library to add material design to my android project
https://github.com/boxme/SquareCamera
But after importing it as a module, I get the following error. How can I fix it
Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
Update buildscript dependencies where your build.gradle file located in
Your_Project/build.gradle
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // This line you need to add
}
}

Categories

Resources