1. 程式人生 > >Android studio中遇到Can't find bundle for base name configd, locale zh_CN解決辦法

Android studio中遇到Can't find bundle for base name configd, locale zh_CN解決辦法

最近一個專案中需要從properties中讀取資訊,結果報Can't find bundle for base name configd, locale zh_CN,百度許久不得解google一下解決問題參考地址點選開啟連結

解決辦法:

1.將main資料夾新增到資原始檔(New > Folder > Java Resources Folder

2.將配置檔案置於resources資料夾下

3.讀取程式碼:

 ResourceBundle motan_config = ResourceBundle.getBundle("config");
        System.out.print(motan_config.getString("url"));