添加本地.aar文件摇篮建立使用与QUOT; flatDirs"不工作摇篮、文件、工作、aar

2023-09-11 20:27:55 作者:好好活着@

我知道这个问题:添加本地.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 文件到 /库和依赖部分:编译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 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)