简体   繁体   English

Android库项目未包含在Gradle构建中

[英]Android library project is not getting included in Gradle build

This query is continuation to my previous question as i did not get answer so i am requesting here. 此查询继续我之前的问题,因为我没有得到答案所以我在这里请求。 My previous question can be found here ( android - gradle multiproject include and exclude libraries ) 我之前的问题可以在这里找到( android - gradle multiproject include和exclude libraries

With productFlavors, one can avoid include and exclude library projects to main project. 使用productFlavors,可以避免将库项目包含和排除到主项目。 In my case, ProjectA----- MainProject, 就我而言,ProjectA ----- MainProject,
LibA ---- Library project, LibA ----图书馆项目,
LibB ---- Library project, LibB ----图书馆项目,
.... ....

LibA classes are used in ProjectA. ProjectA中使用了LibA类。 LibB classes are not used any where. 任何地方都不使用LibB类。 Its just a library but required as part of ProjectA.apk(Mentioned only in ProjectA manifest file) 它只是一个库,但需要作为ProjectA.apk的一部分(仅在ProjectA清单文件中提到)

After "gradle build", in build/classes/flavor/debug or release/packageName/.. only LibA classes are there. 在“gradle build”之后,在build / classes / flavor / debug或release / packageName / ..中只有LibA类。 LibB classes are not there in build/classes/.. path and LibB functionality is not working. libB类不在build / classes / ..路径和LibB功能不起作用。 (Note: The same is working fine with eclipse build) (注意:使用eclipse构建时工作正常)

LibB classes are getting included if by importing LibB classes in ProjectA but LibB is like plug and play type library and not required for all the time. 如果通过在ProjectA中导入LibB类来获取LibB类,但LibB类似于即插即用类型库,并且不是一直需要的。

LibB build.gradle file is as follows: LibB build.gradle文件如下:

buildscript {
    repositories {mavenCentral()}
    dependencies {
        classpath 'com.android.tools.build:gradle:0.3'}
}
apply plugin: 'android-library'
android {
    compileSdkVersion 14
    sourceSets {
        main {
            manifest {srcFile 'AndroidManifest.xml'}
            java {srcDir 'src'}
            res {srcDir 'res'}
            assets {srcDir 'assets'}
            resources {srcDir 'src'}
            jni {srcDir 'jni'}
        }
    }
    task configureRelease << {
      proguard.enabled = true
    }
  }

How to get include LibB? 如何获得包括LibB? Please guide me resolving this issue. 请指导我解决这个问题。

Thanks in advance 提前致谢

You need add dependencies node... 您需要添加依赖项节点...

dependencies {
    compile project(':LibB')
}

android {
   XXX
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM