对于数组
app.gradle
buildConfigField "String[]", "URL_ARRAY", "{" + ""http:someurl"," + ""http:someurl"," + ""http:someurl"" + "}"
对于地图
buildConfigField "java.util.Map<String, String>", "NAME_MAP", "new java.util.HashMap<String, " + "String>() {{ put("name", "John"); put("name1", "John"); put("name2", " + ""John"); }}"
用代码访问:
HashMap<String, String> name = (HashMap<String, String>) BuildConfig.NAME_MAP;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)