android - android项目未使用gradle识别jar文件

标签 android gradle

我有一个本地文件{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/

相关文章:

android将数据库从内部存储复制到外部存储返回空数据库

java - JAVA Jacoco错误的线路覆盖率

windows - Gradle无法运行我想要的shell命令行

java - 将所有库版本移动到多模块 gradle 项目中的根 gradle 文件

android - 有没有办法为目标 API 编写单元测试

android - "mnt/sdcard"总是 Android 中的外部存储吗?

android - Cordova 中的后台 Firebase 推送通知

gradle - Gradle:如何强制执行整个子树的版本?

google-app-engine - 如何针对Google App Engine应用运行守夜

android - 虚拟键盘出现倾斜