今天使用Android Studio 2.0打开我之前的项目时,编译报了如下错误:

Error:Cause: com/android/build/gradle/internal/model/DefaultAndroidProject : Unsupported major.minor version 52.0

其中build.gradle文件内容如下所示:

// 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:2.2.0-alpha4' // 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
}

如上所示,gradle的版本为2.2.0-alpha4。这是因为今天下了一个Android Studio 2.2 Preview4,然后将该项目在Android Studio 2.2 Preview4中打开过,原来的gradle版本是2.0.0

解决办法

方法1

直接不用Android Studio 2.0了,转而使用Android Studio 2.2 Preview4编译该项目,继续开发。

方法2

在Android Studio 2.0中继续开发该项目,修改build.gradle文件内容,将gradle版本改成2.0.0,代码如下:

// 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:2.0.0' // 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
}

原文:http://blog.csdn.net/ouyang_peng/article/details/51799001

,

最新文章

  1. 『.NET Core CLI工具文档』(十二)dotnet-pack
  2. elasticsearch5.0.0 安装插件及配置过程
  3. Mac下搭建hexo
  4. MVC 支持同名路由,不同命名空间
  5. 微软Dynamics 使用葡萄城的Wijmo 5提供移动端用户界面选择
  6. visual studio 2012 的制作ActiveX、打包和发布
  7. if for case 及多参数同时传递
  8. WPF的Binding功能解析
  9. 习总强调网络安全 ,咱们国产SSL证书必须加快普及速度
  10. C++ Sets
  11. 使用md5判断网站内容是否被篡改
  12. Android 原生 Intent 分享支持的那些事
  13. Linux无法连接上127.0.0.1,拒绝连接,更新时提示无法下载,无法正常使用apt-get update
  14. 201521123037 《Java程序设计》第9周学习总结
  15. 24 python初学(异常)
  16. CCF-炉石传说
  17. hdoj:2058
  18. java static方法不能被重写@Override
  19. ifconfig不显示网卡eth0
  20. 哈希+Bfs【P2730】 魔板 Magic Squares

热门文章

  1. swift VS NSObject
  2. 音视频】5.ffmpeg命令分类与使用
  3. 【转载】原 IntelliJ IDEA (idea)引入eclipse web项目
  4. Microsoft SQL Server Transact-SQL
  5. vue中websoket的使用
  6. 你相信吗??Python把数字也当做对象!@@@对象,名称绑定,引用计数
  7. dual boot
  8. naca0012
  9. SQL学习笔记:基础SQL语句
  10. hdu 1754 I Hate It(线段树水题)