_When importing downloaded AS projects, we often encounter "Plugin with id'com.android.application'not found". This happens because the project lacks a build.grade. Com. android. application comes from com.android.tools.build:gradle:2.3.0 (version may be different). And com.android.tools.build:gradle:2.3.0 is defined in build.grade (Project **).
_. General gradle files are divided into two parts: project and module. Android's engineering structure is project-based and can add multiple modules.
build.grade(Project**)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'//Here is your AS version.
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()//maven Warehouse Address
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.grade(Module**)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "locating.indoor.autonavi.com.onlinelocationdemo"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
abiFilter "armeabi"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
In this case, copy the code in build.grade(Project **) to build.grade(Module **) and TryAgain. Be careful not to forget to change your AS version.