Gradle没有拿起我的Android库

时间:2014-07-16 01:19:52

标签: android gradle

我正在尝试创建一个库/应用程序项目,但似乎Gradle不想找到我的库模块。

文件夹层次结构:

<Project>
    app/
        build.gradle
        ...
    library/
        build.gradle
        ...
    build.gradle
    settings.gradle

Gradle:Root settings.gradle

    include ':app', ':library'

Gradle:Root build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Gradle:Library build.gradle

apply plugin: 'com.android.library'
android {
   ...
}

Gradle:App build.gradle

apply plugin: 'com.android.application'
android {
    ...
}
dependencies {
    compile project(':library')
}

库似乎编译并生成.AAR文件,但由于“package ....不存在”,应用程序将无法编译 - &gt;链接到库类

1 个答案:

答案 0 :(得分:2)

通过删除Library模块上的这一行(我的库模块必须编译JNI)来修复

productFlavors {
    arm {
        ndk {
            abiFilters "armeabi-v7a", "armeabi"
        }
    }
}