目前,我的Android应用程序项目是针对本地库项目编译的,如下所示:
// build.gradle
dependencies {
compile project(':Library-Project')
compile files('libs/library.jar') // Resolve into this if Library-Project is not available
}本地库项目构建到library.jar中,并放置在libs文件夹中。
如果本地项目不存在而不对library.jar进行注释而不是针对jar进行编译,那么是否有一种方法可以对jar工件进行回退?
发布于 2016-12-08 03:10:35
使用一种更动态的方法,实际上应该编译依赖关系。
dependencies {
// Check if the local project exists, and compile against that if it does
if ( new File("/Library-Project").exists() )
{
compile project(':Library-Project')
}
// Local project DNE, compile against JAR file
else
{
compile files('libs/library.jar')
}
}另一种自动编译/libs文件夹中所有JAR文件的方法是在dependencies块中添加以下行:
compile fileTree(include: ['*.jar'], dir: 'libs')https://stackoverflow.com/questions/41028430
复制相似问题