我有一个本地文件{projectroot}/libs/javacsv.jar
并将其包含在build.gradle中,该文件也位于项目的根目录中,如下所示
dependencies {
classpath 'com.android.tools.build:gradle:0.7.0'
compile fileTree(dir: 'libs', include: '*.jar')
}
但是,当我编译项目时,我仍然得到
A problem occurred evaluating root project 'myproject'. No such property: compile for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
我该如何解决这个问题,我只想用我的libs dir编译我的android项目:/
最佳答案
build.gradle
中有两个依赖项部分:
buildscript {
repositories {
//repositories for build script dependencies
}
dependencies {
//dependencies for build script
}
}
apply plugin: 'android'
repositories {
//repositories for project dependencies
}
android {
....
}
dependencies {
//dependencies for project
}
因此,将您的libs部分移至正确的位置。
关于android - android项目未使用gradle识别jar文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20800644/