代码:
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.android.sunshine.app;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.android.sunshine.app";
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 OPEN_WEATHER_MAP_API_KEY = 4ae9a193e3ce7970984625be19352fd6;
}
我认为错误可能在行
中发生public static final String OPEN_WEATHER_MAP_API_KEY = 4ae9a193e3ce7970984625be19352fd6;
一定是
public static final String OPEN_WEATHER_MAP_API_KEY = "4ae9a193e3ce7970984625be19352fd6";
但是当我更改代码并运行时,Android Studio会自动更改为代码。
答案 0 :(得分:0)
将build.gradle
更新为:
buildTypes.each {
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', "\"4ae9a193e3ce7970984625be19352fd6\""
}