在libs文件夹中的jar文件的Andr​​oid摇篮不习惯建设文件、不习惯、摇篮、夹中

由网友(我为王者狂)分享简介:我刚开始的摇篮构建系统为Android玩。i just started to play with the gradle build system for Android.但我不能建立我的项目之一。它依赖于库/文件夹中的罐子。However i'm not able build one of my projects...

我刚开始的摇篮构建系统为Android玩。

i just started to play with the gradle build system for Android.

但我不能建立我的项目之一。它依赖于库/文件夹中的罐子。

However i'm not able build one of my projects. It depends on a jar in the libs/ folder.

摇篮构建无法在 compileDebug 的任务,因为所有的jar文件的类人失踪。

Doing gradle build fails in the compileDebug task because all of the classes from the jar file are missing.

这是一个库项目!这是我的build.gradle文件:

It is a library project! Here is my build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.2'
    }
}

apply plugin: 'android-library'

android {
    target='android-16'
    sourceSets {
        main {
            manifest {
                srcFile 'AndroidManifest.xml'
            }
            java {
                srcDir 'src'
            }
            res {
                srcDir 'res'
            }
            assets {
                srcDir 'assets'
            }
            resources {
                srcDir 'src'
            }
        }
    }
}

我失去了一些东西明显?

Am i missing something obvious?

Goddchen

推荐答案

刚刚找到自己的答案:

看起来像Android的摇篮插件的当前版本不查找在库/文件夹中的罐子。所以,你必须自己添加他们:

Seems like the current version of the Android Gradle plugin doesn't look for jars in the libs/ folder. So you have to add them yourself:

dependencies {
    compile files('libs/mylib.jar')
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

之内将这个这样的机器人命名空间:

android {
    target = "android-15"

    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar')
    }
 }
阅读全文

相关推荐

最新文章