今天在用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. c#实现简单金山打字小游戏(源码)

    using GameDemo.Utils;using System;using System.Collections.Generic;using System.Linq;using System.Te ...

  2. HUAS_ACM 个人训练#2 C

    题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=117538#problem/C 题目大意:给出一个字符串,然后给出一系列的x,y ...

  3. LaTex编译错误

    Error Launching Console Application PDFTeXify ... Command Line: gbk2uni.exe "XXX" Startup ...

  4. php 开启socket配置

    我在Windows命令行输入命令:C:\wamp\bin\php\php5.2.6\php.exe getXml.php以执行php文件. 出现错误:Fatal error: Call to unde ...

  5. 字符串转数字_atoi_stringstream

    一.#include <cstdlib> 字符串转换到整型数,函数原型:int atoi(const char *nptr) 注意事项:有符号整型,能转换的最大字符串是:"214 ...

  6. WPF整理-使用逻辑资源

    "Traditional application resources consist of binary chunks of data, typically representing thi ...

  7. Oracle ORA-01722: 无效数字 处理方法

    C# + Oralce 10G 项目中 有用参数处理Update语句.参数命名和表字段同名.执行报错: ORA-01722: 无效数字 后修改所有的参数和对应字段不同.解决. 修改前: StringB ...

  8. MySql存储过程的操作

    [存储过程1] 写一个存储过程 procedure实现两数相加 DELIMITER && CREATE PROCEDURE pr_add(xx INT,yy INT) BEGIN DE ...

  9. EntityFramework Reverse POCO Code First 生成器

    功能强大的(免费)实体框架工具 Julie Lerman 实体框架是开源的,因此开发社区可以在 entityframework.codeplex.com 上共享代码. 但是不要将自己局限在那里寻找工具 ...

  10. select case巧用 oracle

    在做报表的时候,经常会用到分段统计数据,这时候,case就比较有用了: 小例子: SELECT   sh.dc_code, g.bg_code,                   TO_CHAR ( ...