0

I have imported a android source code from Github and while syncing the gradle process I have got an error

Error:(1, 0) Plugin with id 'com.android.application' not found. Open File

This is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "activities.safepassbeta"
        minSdkVersion 16
        targetSdkVersion 19
        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:support-v4:20.0.0'
}
Alexey
  • 1,198
  • 1
  • 15
  • 35

2 Answers2

0

Try changing the classpath in the top level build.gradle file to 'com.android.tools.build:gradle:2.0.0-beta7' and the distributionUrl value in gradle-wrapper.properties file to https://services.gradle.org/distributions/gradle-2.10-all.zip.

Make sure that in the settings for gradle in the 'Build, execution and deployment' section, you have set the preference to 'Use default gradle wrapper'.

Pratzz
  • 107
  • 1
  • 7
0

As the other answer described, try changing the classpath in the top level build.gradle file. The file you show is the application build.gradle, not the top level build.gradle file. For Android Studio 3, you can try using 'com.android.tools.build:gradle:3.0.1'. The problem is that the gradle dependency is not downloading properly, usually because of improper settings for the url to use to download gradle. This is a common problem. If the problem persists look into solutions for how to set up gradle, such as Manually install Gradle and use it in Android Studio

A quick-and-easy fix is to look at your previous projects which work on your IDE, look at what version of gradle they are using. If you use that version of gradle in this project it will most likely work.

However, the 'proper' solution is to set up the distributionUrl properly. Worst come to worst, if that does not work, you could also try manually downloading Gradle to use it in your project.

hexicle
  • 2,121
  • 2
  • 24
  • 31