Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Error:(3, 0) Plugin with id 'com.android.application' not found

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!

like image 510
Ryan Avatar asked Nov 05 '14 05:11

Ryan


People also ask

Why my app is not opening in Android Studio?

It is because you are running it as a 'test' and not as an 'Android Application'. Open the "Edit Configurations" pane and click the '+' button. Select the option to create a new 'Android Application' and then select the correct module.

What is Android plugin for Gradle?

The Android Gradle plugin (AGP) is the official build system for Android applications. It includes support for compiling many different types of sources and linking them together into an application that you can run on a physical Android device or an emulator.


1 Answers

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.

like image 81
River Avatar answered Sep 28 '22 00:09

River