无法构建取决于其他模块的Gradle



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

从低级别开始 Android Library

  • 逻辑

通过基础 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运行,但是在这种情况下,更改构建变体调试/发行版不会在应用程序中更改变体,我需要的是,我想将更多的productflavors放在"客户端"中,即 featureON{} featureOFF{}

相关问题:

  • 类似的问题实施项目':libmodule中的app'不起作用
  • 将应用程序模块作为依赖项添加应用程序模块依赖关系到Android Studio中的另一个应用程序模块

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 App Module"。

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

最新更新