我有一个 Android 应用程序模块 (A) 和一个 Android 库模块 (B)。(A) 和 (B) 都包含这些相同的依赖项:
dependencies {
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
Run Code Online (Sandbox Code Playgroud)
但是,在我的项目中,模块 (A) 依赖于模块 (B),因此我确实在堆栈溢出中搜索了有关如何实现Don't Repeat Yourself设计模式的信息,以便我仅将这些依赖项包含在模块 (B) 中,我发现这很有用但我没有找到我怎么能做出这种依赖
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1
Run Code Online (Sandbox Code Playgroud)
在这两个模块之间共享,那么我该怎么做呢?
android android-gradle-plugin annotation-processor android-module
我正在尝试使用Gradle构建一个Android项目.
它具有以下结构:
ProjectA----- MainProject,
LibA ---- Library project,
LibB ---- Library project,
LibC ---- Library project,
LibD ---- Library project,
etc...
Run Code Online (Sandbox Code Playgroud)
基于situtation,我需要包含库,有时需要包括所有库,1库,2或3等基于flavor.在设置文件中,我包含了所有项目.
有人知道如何根据口味包含/排除库吗?
我试过依赖阻止,我收到错误.
以下是示例代码
dependencies {
if (task.name.matches('compileFlovor1'){
exclude module: 'LibD'
}
}
Run Code Online (Sandbox Code Playgroud)
错误是:找不到参数[{module = LibD}]的方法exclude().
请指导我解决这个问题