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. 反射学习1、反射机制的介绍和基本的API的使用

    关于动态语言: 一般而言,开发者社群说到动态语言,大致认同的一个定义是:“程序运行时,允许改变程序结构或变量类型,这种语言称为动态语言”.从这个观点看,Perl,Python,Ruby是动态语言,C+ ...

  2. redis命令_ZREM

    ZREM key member [member ...] 移除有序集 key 中的一个或多个成员,不存在的成员将被忽略. 当 key 存在但不是有序集类型时,返回一个错误. 在 Redis 2.4 版 ...

  3. ext,exrReturn新增,修改删除等用

    package cn.edu.hbcf.common.vo; /** * Ext Ajax 返回对象 * * @author * @date 2012-02-21 19:30:00 * */ publ ...

  4. PHP从千千静听服务器获取lrc歌词

    <?php //转载请注明出处 uenucom function SingleDecToHex($dec)  {  $tmp="";  $dec=$dec%16;  if($ ...

  5. 【vijos】1750 建房子(线段树套线段树+前缀和)

    https://vijos.org/p/1750 是不是我想复杂了.... 自己yy了个二维线段树,然后愉快的敲打. 但是wa了两法.......sad 原因是在处理第二维的更新出现了个小问题,sad ...

  6. ASP.NET动态增加HTML元素的方法实例小结

    本文实例讲述了ASP.NET动态增加HTML元素的方法.分享给大家供大家参考,具体如下: 在使用asp.net进行web开发的时候页面中的<head></head>中的信息可以 ...

  7. TypeScript 函数 (五)

    传递给一个函数的参数个数必须与函数期望的参数个数一致. 参数类别: 必须参数 可选参数 :可选参数必须在参数后面. 默认参数 :当用户没有传递这个参数或传递的值是undefined时. 它们叫做有默认 ...

  8. java 连接mariadb 无法获取数据源的问题,在ubuntu上部署的时候(原创)

    问题: 连接数据库时报错: log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).log4j:WARN ...

  9. Android开发:《Gradle Recipes for Android》阅读笔记(翻译)4.4——自定义代码集合

    问题: 你想要在项目中使用非标准的代码目录. 解决方案: 在gradle的build配置里面使用sourceSets属性. 讨论: Android分发的samples里面使用多个代码目录,使得通用的文 ...

  10. noip2006 金明的预算

    题目链接:传送门 题目大意:略.. 题目思路:其实单就这道题来说,一个主件最多两个附件,且附件不再包含附件,所以很简单,但是如果主件的附件无限制,附件也可包含无限制的附件,应该怎么做? 首先推荐一篇论 ...