0
我已經在我的~/.gradle/gradle.properties
中定義了一個屬性,我想在字符串資源文件中訪問它。如何用戶字符串資源文件中的resValue
定義在~/.gradle/gradle.properties
ServerIP="XXX.XXX.XX.XX"
宣言app/build.gradle
android {
buildTypes.each {
it.resValue "string", "ServerIP", "SERVER_IP"
}
}
使用在string/web_services.xml
<string name="serverIP">@string/SERVER_IP</string>
構建過程中的錯誤
Error:(4, 5) No resource found that matches the given name (at 'serverIP' with value '@string/SERVER_IP').
有沒有辦法實現這個或不能做什麼?