Android Gradle Plugin中 ApplicationVariant文件内的可用属性
来源:互联网 发布:淘宝买韩国专辑靠谱吗 编辑:程序博客网 时间:2024/06/06 07:17
接口ApplicationVariant的继承关系如下:
BaseVariant --> ApkVariant -|
TestVariant -| -->ApplicationVariant
接口可以获取的字段有:
一、自有属性:无
二、继承自BaseVariant属性:
String name:变体名字
String description:变体描述
String dirName:变体子文件夹,通常是构建类型和偏好的混合
String baseName:变体输出名称的基础名
String flavorName:变体的偏好名,这是一串所有使用到的偏好名串起来的字符串
List<BaseVariantOutput> outputs:非空的变体输出列表,至少一个
BuildType getBuildType:变体的的缺省构建类型
ProductFlavor mergedFlavor:变体的默认产出偏好,它是一个缺省配置和所有应用到的偏好的合并。
List<ProductFlavor> productFlavors:变体缺省生产偏好列表,可能是空的但不会是null
List<SourceProvider> sourceSets:按升序排列的源码提供器,也就是说,越早的内容会被越新的覆盖。
String applicationId:变体的应用编号
Task preBuild:预构建标记任务
Task checkManifest:清单检查任务
AidlCompile aidlCompile:AIDL文件编译任务
RenderscriptCompile renderscriptCompile:渲染脚本编译任务
MergeResources mergeResources:资源合并任务
MergeSourceSetFolders mergeAssets:Asset文件合并任务
GenerateBuildConfig generateBuildConfig:BuildConfig文件生成任务
JavaCompile javaCompile() throws IllegalStateException:在配置为使用javac编译源文件时返回一个Java编译任务。不过已经过期,使用javaCompiler替代,替代任务将总是返回一个Java编译任务,不管使用何种工具链(javac或者jack)
AbstractCompile getJavaCompiler:根据项目配置返回一个javac或者jack的Java编译任务
NdkCompile ndkCompile:ndk编译任务
Task obfuscation:混淆任务
File mappingFile:混淆Map文件。如果未开启混淆,将是null
AbstractCopyTask processJavaResources:Java资源处理任务
Task assemble:该变体的所有输出的组装任务
向模型中添加新的源文件夹,这些源文件夹不会在缺省构建系统中使用,但会和缺省Java源文件夹一起传递给那些查询该模型的。
void addJavaSourceFoldersToModel(@NonNull File... sourceFolders):
void addJavaSourceFoldersToModel(@NonNull Collection<File> sourceFolders);
向变体中添加一个用于产生Java源代码的任务。这会使得变体源生成任务依赖于该任务并且作为编译输入添加新的源文件夹。新添加的源文件加也会被加入到模型中。
@param task the task
@param sourceFolders the source folders where the generated source code is.
void registerJavaGeneratingTask(@NonNull Task task, @NonNull File... sourceFolders);
@param task the task
@param sourceFolders the source folders where the generated source code is.
void registerJavaGeneratingTask(@NonNull Task task, @NonNull Collection<File> sourceFolders);
向变体中添加一个用于产生资源的任务。这会使得该变体的资源生成任务依赖于该任务,并且作为资源合并输入添加资源文件夹。这种资源文件夹也会加入到模型中。
@param task the task
@param resFolders the folders where the generated resources are.
void registerResGeneratingTask(@NonNull Task task, @NonNull File... resFolders);
@param task the task
@param resFolders the folders where the generated resources are.
void registerResGeneratingTask(@NonNull Task task, @NonNull Collection<File> resFolders);
添加一个变体相关的BuilConfig属性。
@param type the type of the field
@param name the name of the field
@param value the value of the field
void buildConfigField(@NonNull String type, @NonNull String name, @NonNull String value);
添加一个变体相关的资源字段值。
@param type the type of the field
@param name the name of the field
@param value the value of the field
void resValue(@NonNull String type, @NonNull String name, @NonNull String value);
如果设置为true,变体输出将会签名,只在如果你手动设置outputs指向由其它任务构建的签名文件时设置。
void setOutputsAreSigned(boolean isSigned);
boolean getOutputsAreSigned();
三、继承自ApkVariant属性:
int versionCode:App的版本号,缺省平台使用值为1.如果output没有定义其自身的变体进行覆盖,那么所有output都将使用该值。
String versionName:App的版本名称,可能是null
@Nullable
SigningConfig signingConfig:如果有指定签名的话,得到变体使用的签名配置,
boolean signingReady:当变体拥有创建一个签名APK所需的信息时为true
已过时
Object getDex();
Collection<File> compileLibraries:除运行时所需外的编译路径上的jar文件列表。
Collection<File> apkLibraries:打包到APK中的jar列表
DefaultTask getInstall:变体安装任务
DefaultTask getUninstall:变体卸载任务。对于非库项目总是true,即使因为没有设置签名而未创建APK
四、继承自TestVariant属性:
TestVariant testVariant:将会用来测试这个变体的变体。只有debug变体才会有。这个是通过TestedAndroidConfig.testBuildType来进行控制的。
UnitTestVariant getUnitTestVariant:包涵这个变体单元测试的变体。
- Android Gradle Plugin中 ApplicationVariant文件内的可用属性
- android studio中gradle plugin版本对应的gradle版本
- 初始android studio 的 Gradle Plugin
- 修改Android Gradle plugin的aapt路径
- Android Gradle Plugin的Transform API
- Android Gradle Plugin 版本
- Gradle Android Plugin 使用手册
- android-maven-gradle-plugin
- Android Gradle Plugin解析
- 【Android】gradle-wrapper.properties中各属性的含义
- Android Gradle plugin版本和Gradle版本
- Android的中Gradle
- Building the Android Gradle Plugin
- Android Gradle Plugin指南(一)
- Android plugin for Gradle基础
- Android Studio 关于gradle和plugin的版本对应
- Android-APK的压缩工具:img-optimizer-gradle-plugin
- 请教:android studio中gradle plugin版本和gradle版本怎么对应?
- SqlServer简单优化
- 对 CNN 中 dropout layer 的理解
- listview中复用带有checkbox小记
- iOS CALayer视图图层
- 一个经典问题 (LCS)
- Android Gradle Plugin中 ApplicationVariant文件内的可用属性
- 启动apk的常用方法
- HttpStatus返回状态码
- 遍历Map的4种方法
- 89.UIScrollView的一些不常用属性
- JSON基础以及JSON字符串转换为JSON对象
- Group by与having理解
- Android官方数据绑定框架DataBinding
- 68、 createSQLQuery与createQuery的区别