按照 http://developer.android.com/samples/index.html 中的步骤操作,我将repeatingAlarm (http://developer.android.com/samples/repeatingAlarm/project.html)项目导入到Android Studio中。不幸的是,我收到以下错误:
无法刷新 Gradle 项目“repeatingAlarm” 该项目正在使用不受支持的 Android Gradle 插件版本 (0.6.3)。 修复插件版本并重新导入项目 快速修复失败 在 build.gradle 文件中找不到对 Android Gradle 插件的任何引用。 请单击链接执行文本搜索,然后手动更新构建文件。
下面是 build.gradle 文件:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
dependencies {
// Add the support lib that is appropriate for SDK 4
compile "com.android.support:support-v4:18.0.+"
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 19
buildToolsVersion "18.0.1"
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
instrumentTest.setRoot('tests')
instrumentTest.java.srcDirs = ['tests/src']
}
}
IDE 告诉我这样的错误: 我该怎么办?
最佳答案
将 buildToolsVersion“18.0.1”更改为最新版本,例如“20.0.1”,它将起作用:)
关于android - 将项目导入 Android Studio 后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21583277/