【发布时间】:2016-05-20 09:09:10
【问题描述】:
我尝试将本地.aar 文件添加到项目中,正如here 所描述的那样,因为我不想在每次更改库代码时都执行this 例程。
所以在我的项目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
我尝试使用这种格式
alphaTestCompile ('my.package:libs/myLib-alphaTest-release:0.1@aar')
还有这个
alphaTestCompile (name:'myLib-alphaTest-release', ext:'aar')
但在这种情况下,gradle 无法解析文件。
我怎样才能使.aar文件也被编译?
【问题讨论】:
标签: android android-studio android-gradle-plugin android-library