如何使用新的Gradle Android Build System手动包含外部aar包

本文翻译自:How to manually include external aar package using new Gradle Android Build System

I've been experimenting with the new android build system and I've run into a small issue. 我一直在尝试新的Android构建系统,我遇到了一个小问题。 I've compiled my own aar package of ActionBarSherlock which I've called 'actionbarsherlock.aar'. 我已经编译了自己的ActionBarSherlock的aar包,我称之为'actionbarsherlock.aar'。 What I'm trying to do is actually use this aar to build my final APK. 我正在尝试做的实际上是使用这个aar来构建我的最终APK。 If I include the whole ActionBarSherlock library as an android-library module to my main project using compile project (':actionbarsherlock') I'm able to build successfully without any problems. 如果我使用编译项目(':actionbarsherlock')将整个ActionBarSherlock库作为android-library模块包含到我的主项目中,我可以成功构建而没有任何问题。

But my problem is that I want to provide that dependency as a aar file package MANUALLY just if I would a JAR then I can't seem to figure out how to properly include it into my project. 但我的问题是,我想将该依赖项作为aar文件包手动提供,如果我想要一个JAR,那么我似乎无法弄清楚如何将它正确地包含在我的项目中。 I've attempted to use the compile configuration but this doesn't seem to work. 我试图使用编译配置,但这似乎不起作用。 I keep on getting cannot find symbol during compile which tells me that the classes.jar from aar package isn't getting included in the classpath. 我继续在编译期间找不到符号,这告诉我来自aar包的classes.jar没有包含在类路径中。

Does anyone know of the syntax to manually include an aar package as a file? 有谁知道手动将aar包作为文件包含的语法?

build.gradle 的build.gradle

buildscript {

 repositories {
     mavenCentral()
  }
  dependencies {
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值