由于一個錯誤,我想在某些設備上使用 glide 庫版本 11,在其他設備上使用版本 10。我不知道我是否可以找出是什么設備并在 build.gradle 中更改它。
if(deviceName.equals(Huawei)){
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}
else{
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
}
uj5u.com熱心網友回復:
構建程序發生在知道設備制造商之前很久,所以這種型別的邏輯是不可能的。
您需要的是運行時邏輯來處理此類問題。為了管理這個,你需要在一個專案中有單獨的模塊,一個依賴于 glide 10,另一個依賴于 glide 11。然后當設備運行應用程式時,你可以確定使用哪個版本。這是一個完全過度設計的解決方案,我不建議這樣做。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/330652.html
