今天在用Android Studio 2.0 打开别人的较早版本生成的工程时, 提示: Gradle DSL method not found: 'android()'。

解决办法为,打开根目录下面的build.gradle, 删掉里面关android的模块。

项目中一般有两个build.gradle, 一个位于项目根目录下(和 .idea目录同级),另一个位于 app/build.gradle。在根目录下的build.gradle里面不应该有 android{} 的模块。而在app下面才有。

发生这个错误可能是因为我在打开项目时候选中了错误的目录,它自己去sync的时候给加自动上了这个android()的模块。

关于 buildToolsVersion is not specified 这个错误,发生在我的根目录下有 android{}模块,而且在文件开头也添加了 apply plugin: 'com.android.application' 的情况下。这个 apply 也只应该出现在app/build.gradle里面。

参考:

http://stackoverflow.com/questions/32153544/errorcause-buildtoolsversion-is-not-specified

http://stackoverflow.com/questions/26759755/error1-0-gradle-dsl-method-not-found-android

[原创] Gradle DSL method not found: 'android()' 和 buildToolsVersion is not specified 的解决办法。的更多相关文章

  1. Gradle DSL method not found: 'android()

    原文错误提示: Error:(16, 0) Gradle DSL method not found: 'android()'Possible causes:<ul><li>Th ...

  2. 【转】解决Gradle DSL method not found: ‘android()’

    [转]解决Gradle DSL method not found: ‘android()’ 最近导入as的项目出了这样的问题 这个问题困扰了我很长时间,好吧,搜了半天全都是runProguard的,最 ...

  3. android studio报错提示: Gradle DSL method not found: 'android() 解决方案

    原文错误提示: Error:(16, 0) Gradle DSL method not found: 'Android()'Possible causes:<ul><li>Th ...

  4. 解决Gradle DSL method not found: ‘android()’

    最近导入as的项目出了这样的问题 这个问题困扰了我很长时间,好吧,搜了半天全都是runProguard的,最后在stackoverflow上搜到解决办法了: http://stackoverflow. ...

  5. 【Android Studio】Gradle DSL method not found:'android()'

    如图所示: 参考:http://www.jianshu.com/p/d370d41fb7da 又遇到了这个问题: 参考:http://stackoverflow.com/questions/24204 ...

  6. android studio ,Gradle DSL method not found: 'compile()'

    用gradle构建android工程出现  Gradle DSL method not found: 'compile()' 错误 检查你外层的build.gradle文件中是不是用了compile方 ...

  7. After Android Studio update: Gradle DSL method not found: 'runProguard()'

    1 具体报错为: Error:(16, 0) Gradle DSL method not found: 'runProguard()' Possible causes:<ul><li ...

  8. Gradle DSL method found: ‘android()’错误

    Gradle DSL method found: ‘android()’错误 和上个错误一样这个也是因为在新版本的Gradle中android()方法已经废弃,但是要注意android()只是在整个项 ...

  9. Android Studio:Gradle DSL method not found: 'runProguard()'

    Android Studio发布了新的1.0版,更新之后却发现原来在0.8下面正常的项目编译失败了,从报错上来看是卡在gradle上面. Gradle DSL method not found: 'r ...

随机推荐

  1. Mongoose 的实例方法中访问静态方法

    方法比较简单,也比较粗糙和丑陋,就是通过构造函数来访问静态方法,大致如下: 123456789 WorkSpaceSchema.methods.getPrice = function(startTim ...

  2. jQuery插件入门

    一:导言 有些WEB开发者,会引用一个JQuery类库,然后在网页上写一写("#"),("#"),("."),写了几年就对别人说非常熟悉JQ ...

  3. java面向对象_抽象类和接口

    一.抽象类 1.抽象方法:由abstract修饰.只有定义没有方法体.用一个分号结尾. 2.抽象类: 1)包含抽象方法的类必须是抽象类 2)由abstract修饰 3)不能被实例化 4)抽象类如果不被 ...

  4. hadoop意外之旅--巧合遇到一只大象

    公司面临转型,所有开发也难免面临转型,开始选择自己想要走的方向进行研究. 说来也巧合,最近正好说搭个hadoop环境玩玩,结果遇到转型还被选为大数据小组组长.(尴尬) 开始一场遇到大象之旅,希望能在这 ...

  5. [ZZ] A Proposal For Compiling Direct3D HLSL With LLVM (Written by Michael Larabel )

    http://www.phoronix.com/scan.php?page=news_item&px=OTI2NA Note:  Something very instersting to w ...

  6. memcached服务器

    memcached是高性能的分布式内存缓存服务器,通过缓存数据库查询结果,减少数据库访问次数,提高动态web应用的速度和可扩展性.为了提高性能,memcached把数据存储在内存中,重启memcach ...

  7. quicksort

    快排.... void quicksort(int *a,int left,int right){ if(left >= right){ return ; } int i = left; int ...

  8. PGPool 配置错误定位 s_do_auth: expecting R got E

    自从按照教程 http://www.pgpool.net/docs/latest/pgpool-zh_cn.html#hba配置好PGPool以后,每次启动 pgpool -c -n -D 都报 s_ ...

  9. js获取上传文件个数 以及名称

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. Java 获取汉字拼音的方法

    package lius.util;   import java.io.Serializable; import java.util.ArrayList;   public class JString ...