简体   繁体   中英

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. 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”. The attached picture shows my implementation of flavorDimensions. However now it is complaining that I have duplicate Constants.java files since the platform updates. 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. My research has yet to find a solution.

在此处输入图片说明

Use one flavor dimension, not two. Both flavors go into that one flavor dimension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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