BuildConfig.DEBUG总是假的建馆项目,摇篮时 [英] BuildConfig.DEBUG always false when building library projects with gradle

查看:224
本文介绍了BuildConfig.DEBUG总是假的建馆项目,摇篮时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BuildConfig.DEBUG不工作(=逻辑设置为false),当我跑我在调试模式下的应用程序。 我用摇篮到build.I有一个库项目,我做此项检查。 BuildConfig.java看起来像这样在build debug文件夹:

BuildConfig.DEBUG is not working (= logically set to false) when I run my app in debug mode. I use gradle to build.I have a library project where I do this check. BuildConfig.java looks like this in the build debug folder:

/** Automatically generated file. DO NOT MODIFY */
package common.myProject;

public final class BuildConfig {
    public static final boolean DEBUG = Boolean.parseBoolean("true");

}

和在发布文件夹中:

public static final boolean DEBUG = false;

无论是在库项目和应用程序项目。

both in the library project and in the application project.

我试图解决这个问题,通过检查其设置的一类我的项目的变量。这个类继承自库,并开始在启动时。

I tried to get around this by checking a variable which is set a class of my project. This class inherits from the library and starts on startup.

<application
        android:name=".MyPrj" ...

这导致了另一个问题:就是用我的DEBUG变量中,应用程序类之前运行一个DataBaseProvider

This led to another problem: is use my DEBUG variable in a DataBaseProvider which runs before the application class.

推荐答案

这本是预期的行为。

库项目只能发布自己版本的变种以供其他项目或模块消耗。

Library projects only publish their release variants for consumption by other projects or modules.

我们正在努力在解决这个但这是不平凡的,需要一个显著的工作量。

We're working at fixing this but this is non trivial and requires a significant amount of work.

您可以跟踪这个问题在<一个href="https://$c$c.google.com/p/android/issues/detail?id=52962">https://$c$c.google.com/p/android/issues/detail?id=52962

这篇关于BuildConfig.DEBUG总是假的建馆项目,摇篮时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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