android field 类型,android – 如何生成buildConfigField与String类型
在我的Android Studio项目中有两个buildConfigField的构建配置:buildTypes {def SERVER_URL = "SERVER_URL"def APP_VERSION = "APP_VERSION"debug {buildConfigField "String", SERVER_URL, "http://dev.myserver.com"buildConfigF
在我的Android Studio项目中有两个buildConfigField的构建配置:
buildTypes {
def SERVER_URL = "SERVER_URL"
def APP_VERSION = "APP_VERSION"
debug {
buildConfigField "String", SERVER_URL, "http://dev.myserver.com"
buildConfigField "String", APP_VERSION, "0.0.1"
}
release {
buildConfigField "String", SERVER_URL, "https://myserver.com"
buildConfigField "String", APP_VERSION, "0.0.1"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
我得到和错误如下:
/path/to/generated/BuildConfig.java
Error:(14, 47) error: ';' expected
Error:(15, 47) error: ';' expected
生成的BuildCofig.java如下:
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.mycuteoffice.mcoapp";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
// Fields from build type: debug
public static final String APP_VERSION = 0.0.1;
public static final String SERVER_URL = http://dev.mycuteoffice.com;
}
我认为APP_VERSION和SERVER_URL没有正确生成作为字符串类型他们没有引号。
我不知道为什么它是这样生成的。请让我知道如何解决这个问题。
更多推荐
所有评论(0)