【问题标题】:Gradle is not picking up my Android LibraryGradle 没有使用我的 Android 库
【发布时间】:2014-07-16 01:19:51
【问题描述】:

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

文件夹层次结构:

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

Gradle:根设置.gradle

    include ':app', ':library'

Gradle:根 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:库 build.gradle

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

Gradle:App build.gradle

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

库似乎可以编译并生成 .AAR 文件,但由于“包 .... 不存在”,应用程序无法编译 -> 链接到库类

【问题讨论】:

  • 我的库使用它来编译 JNI 代码,该行无法将库作为 Dependency productFlavors { arm { ndk { abiFilters "armeabi-v7a", "armeabi" } } }

标签: android gradle


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2016-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2014-03-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多