-2

I have just installed Android and all relative tools required to run android development. Unfortunately at the initial build of Gradle sync, event log prints out an error message

Error message (Event log):

Gradle sync failed: Plugin with id 'com.android.applications' not found. Consult IDE Log for more details

Here's is the current Project (build.gradle) My application configuration:

// Top-level build file where you can add configuration options common to
//   all sub-projects/modules.

buildscript {
   repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
    repositories {
    jcenter()
  }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And the current Module (build.gradle) configuration:

 apply plugin: 'com.android.application'

 android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

 defaultConfig {
    applicationId "com.example.user.myapplication"
    minSdkVersion 9
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
 }
 buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
        'proguard-rules.pro'
      }
  }
 }

 dependencies {
 }
Sharkes Monken
  • 661
  • 5
  • 23
  • 4
    Possible duplicate of [Error:(1, 0) Plugin with id 'com.android.application' not found](http://stackoverflow.com/questions/24795079/error1-0-plugin-with-id-com-android-application-not-found) – W4R10CK Sep 21 '16 at 04:28
  • i read the whole solution it didn't work right @W4R10CK – Sharkes Monken Sep 21 '16 at 04:41
  • It generally happens when u dont have `gradle` liberary, try adding it along with googleplay liberary. – W4R10CK Sep 21 '16 at 04:42
  • add this to dependencies on your below file. `compile fileTree(include: ['*.jar'], dir: 'libs')` `testCompile 'junit:junit:4.12'` – W4R10CK Sep 21 '16 at 04:45
  • Well yeah i tried nitinsingh attempt to remove the gradle dir and let android recreate appropriate gradle and i found that same dependency you mentioned it appeared into a new module with extra additonal dependency such as compile and testCompile @W4R10CK – Sharkes Monken Sep 21 '16 at 05:02
  • yep, the dependencies you see are by default, I must say now it will work. – W4R10CK Sep 21 '16 at 05:40

2 Answers2

0

Try this

File -> Invalidate caches / Restart

Shutdown Android Studio Rename/remove .gradle folder in the user home directory

Restart Android Studio let it download all the Gradle stuff it needs Gradle build success !

Rebuild project.... success !

Out of curiousity I compared the structure of the old .gradle and the new one.

they were pretty different.!

noufalcep
  • 3,446
  • 15
  • 33
  • 51
Nitin Singh
  • 145
  • 6
0
  1. make a file named "settings.gradle".

  2. add this line to this file -> include ':app'

  3. copy this file to the root directory of your project.

  4. Re-open project

  • Sorry such kind of file did exist at initial configuration apart from dependencies that were required where missing on Module file @HiteshLalwani – Sharkes Monken Sep 21 '16 at 05:09
  • in that case, i think u will have to update "gradle-wrapper.properties" distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip – Hitesh Lalwani Sep 25 '16 at 15:28