无法建立依赖于其他模块的gradle

时间:2019-05-13 10:32:41

标签: android android-gradle

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

从底层 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运行,但是在这种情况下,更改构建变体调试/发行版不会更改应用程序中的变体,这是我需要的,因为我想在'client'中放置更多productFlavors,即featureON{} featureOFF{}

相关问题:

1 个答案:

答案 0 :(得分:0)

android应用将具有以下模块。

Android应用模块

Android库(aar)

Android Java库(罐子)

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