2

out of the blue, I got this error that I can not find a way to fix. Plugin with id 'com.android.application' not found. If there are any more files that you guys need to see, feel free to ask me. Thank you!

It's referring me to this file:

Here is my build.gradle(Project OddJob):

apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.tamir.offen.actionbar" minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { maven { url 'https://dl.bintray.com/spark/maven' } } configurations.all { resolutionStrategy { force 'com.android.support:support-annotations:23.1.1' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.google.android.gms:play-services-maps:15.0.1' implementation "com.google.android.gms:play-services-location:15.0.1" implementation 'com.android.support:support-v4:26.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'me.spark:submitbutton:1.0.1' implementation 'com.wdullaer:materialdatetimepicker:3.1.3' // for the bottom nav bar: implementation 'com.android.support:design:27.1.1' } 

Here is build.gradle(Module App):

apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.tamir.offen.actionbar" minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.google.android.gms:play-services-maps:15.0.1' implementation "com.google.android.gms:play-services-location:15.0.1" implementation 'com.android.support:support-v4:26.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'me.spark:submitbutton:1.0.1' implementation 'com.wdullaer:materialdatetimepicker:3.1.3' // for the bottom nav bar: implementation 'com.android.support:design:27.1.1' } 

2 Answers 2

4

Android Studio: Plugin with id 'com.android.application' not found

  • You are missing classpath 'com.android.tools.build:gradle:3.1.3' in top level project dependencies.

  • Check Top level project build.gradle

build.gradle(Project OddJob):

// 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.1.3' // 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 //} 
Sign up to request clarification or add additional context in comments.

7 Comments

Do I just copy past this into the build.gradle(project)?
I got this error: Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed. And also what do you mean by 'Check Top level project build.gradle'
Just remove clean task part and try again, Updated my answer.
Thank you for your quick replays! I deleted the clean task part and got this error: Cannot read packageName from C:\Users\tamir\Desktop\OddJob\src\main\AndroidManifest.xml
Try to Android Studio > Build > Clean Project .
|
1

Try This

  • Add the following code to the top of your build.gradle in your project like this:

    / 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.1.3' classpath 'com.google.gms:google-services:3.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() google() } } task clean(type: Delete) { delete rootProject.buildDir } 
  • Open gradle-wrapper.properties and add url like this:

     Wed May 30 16:36:49 IST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip //add this line in you project. 

it helps you

Comments