问题描述
我有一个Android项目,这取决于纯Java项目。它们都依赖于另一个Java库,也在我的Android Studio中的多项目gradle中设置。我有两个版本的库,并希望Android和Java项目依赖其中的一个在调试模式,另一个 - 在发布。
I have an Android project, that depends on pure Java project. Both of them depend on another Java library, also in my multiproject gradle set in Android Studio. I have two versions of that library and want both Android and Java projects to depend on one of them in debug mode, and another - in release.
Android是可能的项目?对于纯Java项目?如何?
Is it possible for Android project? For pure Java project? How?
推荐答案
构建类型(调试,发布或自定义)可以有自己的依赖关系。
Build Types (debug, release, or custom) can have their own dependencies.
要指定特定于构建类型的依赖关系,请执行以下操作:
To specify a dependency specific to a build type, do the following:
dependencies {
debugCompile "mydebugdependency"
releaseCompile "myreleasedependency"
}
java项目和android项目都使用gradle,你可以在他们的build.gradle文件中做上述操作。
If your java project and android project are both using gradle, you can do the above in both of their build.gradle files.
这篇关于在gradle和Android Studio中调试和发布的不同依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!