Error phenomenon:
Probably mean is not found: com.android.application plug-in, the above phenomenon for beginners will often encounter, the following analysis of the cause of the resulting.
Cause analysis
First take a look at the imported engineering structure:
Is there a question for this engineering structure? This is not the normal synchronization complete structure, Gradle scripts below seems to be a build.gradle, the Red box section describes clearly is Module:graphicsdemo, said the Build.gradle is the Module, Instead of project. Look at what a normal Project+module project is:
Notice the red box location, one project and one Module. What is the difference between these two build.gradle? As we all know, Android Studio is based on project when it comes to organizing engineering structures, and can create multiple module on its basis, as shown in! Many developers in the contribution of their own code to github or CSDN download channel, the module directly to the entire folder dropped, resulting in the download of the use of the above error phenomenon. The reason, or first understand the next two types of gradle file of the wrong use it!
Build.gradle (PROJECT:XXXX)
The file is the entire project-compiled global file with the highest priority
The source code is as follows:
//top-level build file where can add configuration options common to all sub-projects/modules.//The highest-priority build file, executed before the module's Build.gradleBuildscript {repositories {jcenter ()//Specify MAVEN image, same as} dependencies {classpath'com.android.tools.build:gradle:2.2.0' //Specify Classpath//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 //clears the specified directory when clean is specified}
From the comments above you can see the role of the file:
1. Compile the top-level files of the project, the highest priority;
2. Specify the MAVEN warehouse address, Gradle related packages are pulled from Maven;
3. Specify classpath, or you will not be able to find some classes, the problem with the title is this reason.
Build.gradle (MODULE:XXX)
This file is a file used by a module at compile time
The source code is as follows:
//Note: Gradle is a plug-in to distinguish between an executable project or a libiary project, the following indicates the execution of the projectApply plugin:'com.android.application'Android {compilesdkversion atbuildtoolsversion"23.0.3"Defaultconfig {ApplicationID"Mashen.graphicsdemo"minsdkversion -targetsdkversion AVersioncode1Versionname"1.0"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile ('Proguard-android.txt'),'Proguard-rules.pro'}}}dependencies {compile filetree (dir:'Libs', include: ['*.jar']) Testcompile'junit:junit:4.12'Compile'com.android.support:appcompat-v7:23.4.0'}
This configuration is familiar to everyone, focus on the first line, apply plugin: ' Com.android.application ' indicates that the current module is an executable project. However, this plugin is not found, the reason is com.android.application from com.android.tools.build:gradle:2.2.0. It's all clear!
Solution:
Copy the configuration script inside the Build.gradle to the Build.gradle inside the module, which is the following script:
Buildscript { repositories { jcenter () } dependencies { ' com.android.tools.build:gradle:2.2.0' // Note: Change to version of own as }} allprojects { repositories { jcenter () }}
View Gradle version: Terminal-> gradle-v (provided the environment variable is configured)
This article transferred from: http://blog.csdn.net/seafishyls/article/details/53572939
Android Studio-Import Project error [Plugin with id ' com.android.application ' not found]