android中的BuildConfig文件-目的和可能性 [英] BuildConfig file in android - Purpose and Possibilities

查看:477
本文介绍了android中的BuildConfig文件-目的和可能性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android在BuildConfig.java中有一个称为DEBUG的标志.有人可以解释一下该文件是如何创建的吗?具有一个包含单个变量的自动生成的文件的目的是什么?

Android has a flag called DEBUG in BuildConfig.java. Can someone please explain how is this file created? What is the purpose of having an auto-generated file with a single variable in it?

在此类内是否可以有除DEBUG标志之外的其他东西?如果我需要除开发和发布配置以外的其他配置怎么办?我该如何实现?

Is it possible to have something besides DEBUG flag inside this class? What if I want a configuration other than development and release configuration? How can I achieve it?

推荐答案

BuildConfig.java由Android构建工具自动生成,并放置在gen文件夹中.

BuildConfig.java is generated automatically by Android build tools, and is placed into the gen folder.

在此处了解更多信息: http://www.digipom.com/be-careful-with-buildconfig-debug/

Read more here: http://www.digipom.com/be-careful-with-buildconfig-debug/

您可以使用Gradle自定义构建: http://toastdroid.com/2014/03/28/customizing-your-build -with-gradle/

You can customizing Your Build With Gradle: http://toastdroid.com/2014/03/28/customizing-your-build-with-gradle/

这篇关于android中的BuildConfig文件-目的和可能性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆