
当我想将新库添加到build.gradle文件时,它会生成错误.
这是我的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:1.0.0' compile 'com.mcxiaoke.volley:library:1.0.+' // NOTE: Do not place your application dependencIEs here; they belong // in the indivIDual module build.gradle files }}allprojects { repositorIEs { jcenter() }}这是错误
C:\Users\Fakher\documents\Play_Store_WS\VolleyJson\build.gradle
The project ‘VolleyJson’ may be using a version of Gradle that does not contain the method.
Error:Error:line (10)Gradle DSL method not found: ‘compile()’
Possible causes:
Gradle settingsThe build file may be missing a Gradle plugin.
Apply Gradle plugin
解决方法:
它不起作用,因为你把依赖放在错误的地方,build.gradle中没有插件来处理你的依赖,你应该在你的app模块内的build.gradle中添加你的依赖.
更好的解释:
在你的项目中有一个名为app的文件夹,就是你的app模块,里面应该有一个build.gradle,在build.gradle中应该是这样的:
apply plugin: 'com.androID.application'androID { compileSdkVersion 21 buildToolsversion "21.1.2" defaultConfig { // bla bla bla }}dependencIEs {compile filetree(dir: 'libs', include: ['*.jar'])//put your dependencIEs here}希望我能帮助你….
总结以上是内存溢出为你收集整理的在Android Studio中添加依赖项时出错全部内容,希望文章能够帮你解决在Android Studio中添加依赖项时出错所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)