grable 导入本地包 local jar
三种方式
单个文件
implementation files('libs/a.jar', 'libs/b.jar')
整目录
implementation fileTree(dir: 'lib', includes: ['*.jar']) // 依赖lib目录下的所有以.jar结尾的文件
implementation fileTree(dir: 'lib', include: '*.jar') // 依赖lib目录下的所有以.jar结尾的文件
implementation fileTree(dir: 'lib', excludes: ['xxx.jar'], includes: ['*.jar']) // 依赖lib目录下的除了xxx.jar以外的所有以.jar结尾的文件
添加仓库
repositories {
flatDir {
dirs 'lib1', 'lib2'
}
}
dependencies { implementation name: 'sample-jar-0.8.7' }
阿里云仓库
repositories {
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/apache-snapshots' }
mavenCentral()
flatDir {
dirs 'lib'
}
}
跳过测试
test {
useJUnitPlatform()
enabled = false
}
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/17057567.html