2013-10-27 50 views
2

这里是我的build.gradle添加罐子摇篮

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:0.6.+' 
    } 
} 
apply plugin: 'android' 

repositories { 
    mavenCentral() 
} 

android { 
    compileSdkVersion 17 
    buildToolsVersion "17.0.0" 

    defaultConfig { 
     minSdkVersion 14 
     targetSdkVersion 18 
    } 
} 

dependencies { 
    compile 'com.android.support:support-v4:+' 
    compile file 'volley.jar' 
} 

当我尝试建立它这个错误appers:如果我尝试

gradle clean 
出现

Gradle: A problem occurred evaluating project ':Name'. 
> No such property: file for class:  org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 

同样的错误

在项目目录中

回答

5

这是错字compile files

dependencies { 
    compile files('volley.jar') 
} 
+3

是什么导致异常是缺少的括号,在这种情况下不能省略(因为'compile'已经省略了它们)。尽管如此,在这里使用'files'而不是'file'很重要。 –

+1

谢谢,我也试过“档案”,结果是一样的。 – TpoM6oH

+0

你的意思是你有同样的错误'没有这样的属性:文件'?可能是因为您的文件位于与项目根文件夹不同的位置。例如。 '库\ volley.jar'。 –