我尝试添加一个本地.aar
文件,因为它描述为here,因为我不想在每次更改我的库代码时都实现this例程。本地.aar文件不支持
所以,在我的项目build.gradle
文件我补充:
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
我的图书馆,我的应用程序都有两个版本 - alphaTest
和myRelease
。我希望每个库都被严格添加到应用程序的相应版本中。
而且在我的应用程序的build.gradle
我有以下dependencies
块:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '**/*.aar'])
compile 'com.android.support:appcompat-v7:23.0.0'
alphaTestCompile files ('libs/myLib-alphaTest-release.aar')
myReleaseCompile files('libs/myLib-myRelease-release.aar')
}
不幸的是,结果我总是受到这样那样的错误:
Error:Project myApp: Only Jar-type local dependencies are supported. Cannot handle: C:\Users\...\myApp\libs\myLib-myRelease-release.aar
我tryed使用这种格式
alphaTestCompile ('my.package:libs/myLib-alphaTest-release:[email protected]')
也是这个
alphaTestCompile (name:'myLib-alphaTest-release', ext:'aar')
但在这种情况下,gradle不能事件解析文件。
我怎样才能让.aar
文件也被编译?
的可能的复制[如何使用本地AAR依赖?](http://stackoverflow.com/questions/28869213/how-to-use -local-aar-dependency) – sschuberth