添加本地.aar文件摇篮建立使用与QUOT; flatDirs"不工作 [英] Adding local .aar files to Gradle build using "flatDirs" is not working

查看:191
本文介绍了添加本地.aar文件摇篮建立使用与QUOT; flatDirs"不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题:添加本地.aar文件我的摇篮打造但该解决方案并没有为我工作。

I'm aware of this question: Adding local .aar files to my gradle build but the solution does not work for me.

我尝试添加这样的语句来我 build.gradle 文件的顶层:

I tried adding this statement to the top level of my build.gradle file:

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

我也把 slidingmenu.aar 文件到 /库和<$ C引用它$ C>依赖部分:编译com.slidingmenu.lib:slidingmenu:1.0.0@aar,但它并没有在所有的工作。

I've also put the slidingmenu.aar file into /libs and referenced it in the dependencies section: compile 'com.slidingmenu.lib:slidingmenu:1.0.0@aar' but it did not work at all.

我试过编译文件(库/ slidingmenu.aar')还有,但没有运气。

I tried compile files('libs/slidingmenu.aar') as well but with no luck.

我在想什么?任何想法?

What am I missing? Any ideas?

P.S。 Android的工作室0.8.2

P.S. Android Studio 0.8.2

推荐答案

在约西亚的回答大厦,这里就是我得到了它的工作。

Building upon Josiah's answer, here's how I got it to work.

在他的指令(下编辑)(文件 - >新建模块 - >导入.JAR / .AAR 的),并导入.AAR。

Following his instructions (under edit) (File -> New Module -> Import .JAR/.AAR) and import your .AAR.

然后在你的项目中build.gradle(不是顶级的,应用程序项下的)添加以下(在依赖部分):

Then in your project build.gradle (not the top level one, the one under 'app') add the following (in the dependencies section):

dependencies {
    compile project(':Name-Of-Your-Project')
}

请注意名称-OF-你的项目应与添加导入的AAR文件(在同一水平应用程序/ .idea

Note Name-Of-Your-Project should match the name of the folder that was added after you imported the AAR file (at the same level as app/.idea under the top most level folder). Or to put it another way...


MyApplication
  .idea
  app
  build.gradle (here's where to add compile project(':ProjectName') to dependency section)
  ProjectName (added automatically after importing, matching the name of your aar file)
  build
  gradle
  etc

这为我工作运行Android 0.8.0工作室。不要忘了(使用工具栏按钮或在的文件 - >同步的),你这样做之后。

This worked for me running Android Studio 0.8.0. Don't forget to synchronize gradle (using toolbar button or in File->Synchronize) after you do this.

(感谢约西亚是他们让我朝着正确的方向)

(Thanks to Josiah for getting me going in the right direction)

(注:在此之前我试着将它添加到libs文件夹,试图操纵顶级 build.gradle 和应用程序级 build.gradle ,但没有奏效我的亚洲遥感协会文件 - 罐子的将正常工作,但不是AAR文件)

(Note: prior to this I tried adding it to the libs folder, trying to manipulate the top level build.gradle and the app level build.gradle, but none of that worked for my aars files--jar's will work fine, but not the aar files)

这篇关于添加本地.aar文件摇篮建立使用与QUOT; flatDirs&QUOT;不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆