错误:(1,0)带有id' com.android.application'的插件未找到 我从三十年代开始搜索和搜索,但没有得到解决方案.....完全卡住了** 我是gradle版本:2.5 .. **的build.gradle(projetc:机器人)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle-experimental:0.2.1"
// 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
}
的build.gradle(模块:应用)
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
applicationId = "com.example.altaf.Android"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
}
}
android.productFlavors {
create("flavor1") {
applicationId = "com.app"
}
}
// Configures source set directory.
android.sources {
main {
java {
source {
srcDir "src"
}
}
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:22.2.0"
}
的build.gradle(模块:opencvlibrary310)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
答案 0 :(得分:1)
像这样修改你的build.gradle(module:opencvlibrary310)
:
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
}
}
}
我正在使用以下版本的实验性gradle插件:
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
<强>更新强>
从app
文件中删除以下行:
android.sources {
main {
java {
source {
srcDir "src"
}
}
}
}
我希望它有所帮助。
答案 1 :(得分:0)
更改apply plugin:“com.android.application” 而不是应用插件: build.gradle中的“com.android.model.application”(模块:app)