android - 模块包含 : not intended for consumption by other components - gradle:3. 0.0-alpha2

标签 android android-gradle-plugin android-build android-studio-3.0

升级为:

  • Android Studio 3.0 金丝雀 2
  • com.android.tools.build:gradle:3.0.0-alpha2

我有一个多模块项目(主应用程序+子模块)

包含在主应用程序中:

dependencies {
    implementation project(path: ':testlib', configuration: 'default')
}

teSTLib 被定义为一个简单的 android 库项目,当包含在 gradle 2.3.0 中并通过编译项目(path: ':teSTLib')时可以正常工作

我收到以下 gradle 错误消息:

无法解析配置“:app:devDebug_signedCompileClasspath”的所有依赖项。 在“项目:teSTLib”上选择的配置“默认” 但它不能用作项目依赖项,因为 它不适合供其他组件使用。

在此上下文中,“不供其他组件使用”是什么意思?该模块被定义为一个 android 库。

这是 teSTLib 的 build.gradle:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
    }
}

apply plugin: 'com.android.library'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"


    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

我错过了什么?

最佳答案

我也遇到这个错误。 Android Studio 3.0 Canary 4 刚刚发布。我更新了它,这也将 gradle 更新到了 4.0rc1。

问题自行消失。

关于android - 模块包含 : not intended for consumption by other components - gradle:3. 0.0-alpha2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44309741/

相关文章:

php - 为什么在 android 中计算与在 php 中不同?

android - 使用 LibraryGlideModule (Glide 4) 找不到 GlideApp

android - 在 Android Studio (cmake) 中使用预构建的共享库

android - 在 Android Studio 中更新 buildToolsVersion '23.0.1' 后出现内存不足问题

java - 适用于 Eclipse 的 Google 插件无法正常工作

android - 从主线程查询android中的数据库

Android Studio 1.0RC4 Gradle 构建错误

android - 在 Android Studio 上为 android 构建 OutsystemsNow 出现 dexException

android - Ant 构建在 Eclipse 中失败

安卓 : Could not find method com. google.analytics.tracking.android.EasyTracker.getTracker