【问题标题】:Unable to build gradle that depend on other module无法构建依赖于其他模块的 gradle
【发布时间】:2019-09-30 07:22:01
【问题描述】:

嘿,我的项目中有很多模块:

从底层android库

开始
  • 逻辑

通过基础 android 应用程序

  • base_app

productFlavors{
   featureON{}
   featureOFF{}
}

buildTypes{
  release{}
  debug{}
}

dependencies{
  implementation project(':logic')
}

到最终用户android应用程序

  • 客户端应用

buildTypes{
  release{}
  debug{}
}

dependencies{
  implementation project(':base_app')
}
ext.gradle_version = '3.4.0'

我来了

ERROR: Unable to resolve dependency for ':client@debug/compileClasspath': Could not resolve project :base_app.
Show Details
Affected Modules: client

ERROR: Unable to resolve dependency for ':client@debugAndroidTest/compileClasspath': Could not resolve project :base_app.
Show Details
Affected Modules: client

ERROR: Unable to resolve dependency for ':client@debugUnitTest/compileClasspath': Could not resolve project :base_app.
Show Details
Affected Modules: client

ERROR: Unable to resolve dependency for ':client@release/compileClasspath': Could not resolve project :base_app.
Show Details
Affected Modules: client

ERROR: Unable to resolve dependency for ':client@releaseUnitTest/compileClasspath': Could not resolve project :base_app.
Show Details
Affected Modules: client

但是,如果我按照以下方式使用它

implementation project(path: ':app', configuration: 'default') 

gradle 运行,但在这种情况下,更改构建变体 debug/release 不会更改应用程序中的变体,这是我需要的,因为我想在 'client' 中放入更多 productFlavors,即 featureON{} featureOFF{}

相关问题:

【问题讨论】:

标签: android android-gradle-plugin


【解决方案1】:

android 应用程序将具有以下模块。

Android 应用模块

Android 库(aar)

Android java 库(jar)

dependencies {
    implementation fileTree(include: ["*.jar"], dir: "libs")
    implementation fileTree(include: ["smack-*-${smackVersion}.jar"], dir: smackDir)
    implementation(name: "ion-${ionVersion}", ext: "aar")
}

我们不能拥有多个“Android 应用模块”。

https://developer.android.com/studio/projects

【讨论】:

    猜你喜欢
    • 2018-04-09
    • 2021-01-23
    • 2020-02-14
    • 1970-01-01
    • 1970-01-01
    • 2012-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多