赞
踩
版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/qq_34564357/article/details/78347180
导入下载的AS项目时经常会遇到“Plugin with id ‘com.android.application’ not found”的报错。出现这个情况是因为项目缺少了一个build.grade。com.android.application来源于com.android.tools.build:gradle:2.3.0(版本可能不同)。而com.android.tools.build:gradle:2.3.0在build.grade(Project**)中定义。
一般的gradle文件是分为项目和模块两个的。Android的工程结构是以项目为基础,可以添加多个模块。
build.grade(Project**)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'//这里是你的AS版本
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()//maven仓库地址
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
12345678910111213141516171819202122
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'
}123456789101112131415161718192021222324252627282930313233
遇到这种情况把build.grade(Project**)中的代码复制到build.grade(Module**)中然后TryAgain就可了。注意不要忘记更改自己的AS版本。
---------------------
作者:我就说我巨可爱吧
来源:CSDN
原文:https://blog.csdn.net/qq_34564357/article/details/78347180
版权声明:本文为博主原创文章,转载请附上博文链接!
apply plugin: 'com.android.application' android { compileSdkVersion 26 //buildToolsVersion '25.0.0' buildToolsVersion "26.0.2" defaultConfig { applicationId "org.xutils.sample" minSdkVersion 14 targetSdkVersion 22 // 不使用api23的动态权限策略 versionCode 1 versionName "1.0" } signingConfigs { debugConfig { storeFile file("debug.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } } buildTypes { release { debuggable false minifyEnabled true signingConfig signingConfigs.debugConfig proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support:support-v4:25.3.0' compile 'com.android.support:recyclerview-v7:25.3.0' compile 'com.android.support:design:25.3.0' compile project(':xutils') }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。