[Android 除錯] Conflict with dependency

时间:2023-03-21 21:42:55

Android Studio build 時的錯誤訊息 : Conflict with dependency
詳細錯誤訊息 : Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ.
原因 : project compiler 和 AVD 模擬器的 SDK 版本不一致 (前者為 26,後者為 27)
解法 : Add build dependencies
    - Fix dependency resolution errors
   https://developer.android.com/studio/build/dependencies#resolution_errors
------------------------------------------------------------------------------------------------------

[Android 除錯] Conflict with dependency
圖 1 error message by Android Studio

[Android 除錯] Conflict with dependency
圖 2 resolution

[Android 除錯] Conflict with dependency
圖 3 resolution

[Android 除錯] Conflict with dependency
圖 4 解決後的 AndroidManifest.xml,下方多出兩個 meta-data 中介設定,用來解決版本衝突的問題