我已经从eclipse和
完成了我的旧项目的gradle导出将其导入android studio。我收到错误:带有id的插件 '的Android'无法找到
我发现了一些对此错误的引用,但这些建议对我没有用,下面是我的build.gradle文件:
apply plugin: 'android'
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':Panic Phase 2:PanicPhase2:PanicAndroid:facebook-android-sdk-master:facebook')
compile project(':google_play_services:libproject:google-play-services_lib')
}
android {
compileSdkVersion 11
buildToolsVersion "23.0.0 rc3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
答案 0 :(得分:0)
您的Gradle插件标识符似乎有误。
尝试将apply plugin: 'android'
替换为apply plugin: 'com.android.application'
答案 1 :(得分:0)
此build.gradle
错误。
首先改变:
apply plugin: 'android'
带
apply plugin: 'com.android.application'
然后从classpath
块移除 dependencies
:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':Panic Phase 2:PanicPhase2:PanicAndroid:facebook-android-sdk-master:facebook')
compile project(':google_play_services:libproject:google-play-services_lib')
}
最后使用您的Android插件的类路径添加 buildscript
块。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
请注意。
classpath 'com.android.tools.build:gradle:0.11.+'
是一个旧插件。 你应该使用
classpath 'com.android.tools.build:gradle:1.3.1'
可能需要更新gradle的版本。
您可以通过编辑文件gradle/wrapper/gradle-wrapper.properties:
distributionUrl=http\://services.gradle.org/distributions/gradle-2.4-all.zip