1、错误描述

刚刚,Android Studio突然编译不了了,报了如下错误:

Error:Could not find property 'compile' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@1b3472dc.

如下图所示:

2.解决方法

根据上面的提示,我去打开了build.gradle文件,发现我的build.gradle文件不知道被谁弄乱了,其中一段代码变成了如下所示:

1、错误原因

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//监测内存泄漏
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
// releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
compile(name: 'common-release', ext: 'aar')
compile(name: 'sync-release', ext: 'aar')
// compile 'com.squareup.picasso:picasso:2.5.2'
compile
'com.android.support:appcompat-v7:23.3.0'compile
'com.android.support:design:23.3.0'compile
'com.fasterxml.jackson.core:jackson-databind:2.7.0'compile
'com.squareup.retrofit2:retrofit:2.0.0'compile
'com.squareup.retrofit2:converter-jackson:2.0.0'compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha3'
testCompile 'junit:junit:4.12'
testCompile 'org.powermock:powermock-module-junit4:1.6.4'
testCompile 'org.powermock:powermock-api-mockito:1.6.4'
testCompile 'org.robolectric:robolectric:3.0'
}

如图所示:

2、解决方法

将上面的gradle文件重新排版,修改为如下所示的代码:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//监测内存泄漏
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
// releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
compile(name: 'common-release', ext: 'aar')
compile(name: 'sync-release', ext: 'aar')
// compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-jackson:2.0.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha3'
testCompile 'junit:junit:4.12'
testCompile 'org.powermock:powermock-module-junit4:1.6.4'
testCompile 'org.powermock:powermock-api-mockito:1.6.4'
testCompile 'org.robolectric:robolectric:3.0'
}

如下图所示:

然后重新编译代码,即可正常。

作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!

转载请保留原文地址:http://blog.csdn.net/ouyang_peng

我的Android进阶之旅------>解决Error:Could not find property 'compile' on org.gradle.api.internal.artifacts.的更多相关文章

  1. 我的Android进阶之旅------>解决Error:Unable to find method 'org.gradle.api.internal.project.ProjectInternal.g

    错误描述 今天在Github上面下载了一份代码,然后导入到Android Studio中直接报了如下图所示的错误: 错误描述如下: Error: Unable to find method 'org. ...

  2. 我的Android进阶之旅------>解决Error: specified for property 'mergedManifest' does not exist.

    错误描述 刚运行从Github上面下载而来的代码时,爆了如下所示的bug,错误描述如下所示: Error:A problem was found with the configuration of t ...

  3. 我的Android进阶之旅------>解决 Error: ShouldNotReachHere() 问题

    在Android项目中创建一个包含main()方法的类,直接右键运行该类时会报如下错误: # # An unexpected error has been detected by Java Runti ...

  4. 我的Android进阶之旅------>解决:debug-stripped.ap_' specified for property 'resourceFile' does not exist.

    1.错误描述 更新Android Studio到2.0版本后,出现了编译失败的问题,我clean project然后重新编译还是出现抑郁的问题,问题具体描述如下所示: Error:A problem ...

  5. 我的Android进阶之旅------>解决Jackson等第三方转换Json的开发包在开启混淆后转换的实体类数据都是null的bug

    1.错误描述 今天测试人员提了一个bug,说使用我们的app出现了闪退的bug,后来通过debug断点调试,发现我们的app转换服务器发送过来的json数据后,都是为null.而之前已经提测快一个月的 ...

  6. 我的Android进阶之旅------>解决Your project contains error(s),please fix them

    在使用eclipse写好Android的代码,代码没有报错.然后想在AVD中运行测试时,弹出错误框,提示信息为:  "Your project contains error(s),pleas ...

  7. 我的Android进阶之旅------>报 error: Apostrophe not preceded by \ 的错误解决办法

    今天对项目进行国际化翻译的时候控制台出现了以下的错误: res/values/strings.xml:100: error: Apostrophe not preceded by \ (in Sorr ...

  8. 我的Android进阶之旅------>解决Android Studio报错:DefaultAndroidProject : Unsupported major.minor version 52.0

    问题描述 今天使用Android Studio 2.0打开我之前的项目时,编译报了如下错误: Error:Cause: com/android/build/gradle/internal/model/ ...

  9. 我的Android进阶之旅------>解决Android Studio编译后安装apk报错:The APK file does not exist on disk

    1.错误描述 今天用Android Studio编译应用后安装APK的时候,报错了,错误如下所示: The APK file build\outputs\apk\OYP_2.3.4_I2Base_64 ...

随机推荐

  1. 分页技术框架(Pager-taglib)学习三(pager-taglib中传递参数时中文乱码问题)

    一.问题描述 问题: 使用<pg:param name="key" />标签传递中文参数时,会有乱码. 原因: 因为它默认是用gb2312来对添加的参数进行编码,如果你 ...

  2. Hello,Ajax

    学习了Ajax技术,写了一个最简单的Ajax应用 <%@page contentType="text/html; charset=utf-8" language=" ...

  3. 分享 stormzhang的Andoid学习之路

    硬件 电脑–推荐Mac 首先声明我不是果粉,个人Windows,Linux,Mac OX系统均用过, 只能说Windows上面的开发工具简直难以恭维,尤其命令行超级难用,而Linux自己必须得花不少时 ...

  4. CAP定理(原则)以及BASE理论

    CAP定理(原则)以及BASE理论 CAP定理(原则)概念 CAP原则又称CAP定理,指的是在一个分布式系统中, Consistency(一致性). Availability(可用性).Partiti ...

  5. R语言中将hello打印10次的两种方法

    我们有两种方法来做这件事情: 1.for结构 for循环重复的执行一个语句,直到某个变量的值不再包含在序列seq中为止. 语法: for (var in seq) statement 例如: > ...

  6. python from import 自定义模块

    from douban250.items import Douban250Item python import 自定义模块 (1)主程序与模块程序在同一目录下: 如下面程序结构: `-- src    ...

  7. pl/sql 实例精解 07

    这章主要讨论 oracle11g 新特性, continue, continue when 语句 continue 的作用同其他编程语言一样. continue when condition 只是当条 ...

  8. .htaccess伪静态实例分享

    首先配置服务器启动重写模块打开 Apache 的配置文件 httpd.conf .将#LoadModule rewrite_module modules/mod_rewrite前面的#去掉.保存后重启 ...

  9. 几个比较经典的算法问题的java实现

    1.八皇后问题 public class EightQueen { private static final int ROW = 16; private static final int COL = ...

  10. iOS conformsToProtocol

    - (BOOL)conformsToProtocol:(Protocol *)aProtocol; 是用来检查对象(包括其祖先)是否实现了指定协议类的方法. 今天遇到一个问题,一个类没有实现proto ...