简体   繁体   English

Android Studio 3.0.1中的android风格问题

[英]issue with android flavors in Android Studio 3.0.1

The latest episode in the never ending task of dealing with Googles string of breaking changes involves flavors. 在处理Google一系列重大变化的永无止境的任务中,最新一集涉及各种风味。 Several months ago I implemented two flavors and then things worked fine. 几个月前,我实现了两种口味,然后一切正常。 Recently I upgraded to Android Studio 3.0.1 and brought my app up to android N. After this update my app would no longer compile complaining that flavors now must reference “flavorDimensions”. 最近,我升级到Android Studio 3.0.1,并将我的应用程序升级到androidN。在此更新之后,我的应用程序将不再编译,抱怨风味现在必须引用“ flavorDimensions”。 The attached picture shows my implementation of flavorDimensions. 所附图片显示了我对flavorDimensions的实现。 However now it is complaining that I have duplicate Constants.java files since the platform updates. 但是现在它抱怨自平台更新以来我有重复的Constants.java文件。 These files each contain an enum for their respective flavors… 这些文件每个都包含一个针对其各自口味的枚举…

package com.deanblakely.SafeTalk;

/**
 * this is the one for the SafeTalk flavor
 */

public class Constants {
    public enum Type
    {
        SafeTalk, SecureChannel;
    }
    public static final Type type = Type.SafeTalk;
}

package com.deanblakely.SafeTalk;

/**
 * this is the one for the SecureChannel flavor */

public class Constants {
    public enum Type
    {
        SafeTalk, SecureChannel;
    }
    public static final Type type = Type.SecureChannel;

}

The flavors won't work if I delete them. 如果删除它们,这些风味将无法使用。

These two Constants.java were tolerated by the older platforms but not by the new. 较旧的平台可以容忍这两个Constants.java,而新平台则不能。 My research has yet to find a solution. 我的研究尚未找到解决方案。

在此处输入图片说明

Use one flavor dimension, not two. 使用一种风味尺寸,而不是两种。 Both flavors go into that one flavor dimension. 两种风味都进入一个风味维度。

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

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