2019-07-17

Android 強迫症發作-gradle紅色底線

相信很多開發者一定會發現gradle dependencies裡通常第一行support-v7 出現紅色底線
找了很多資料大概的意思是專案的(通常是新版本),有舊版本的support庫.發生衝突,阿咧.
這種情況,很嚴重?,又好像很不嚴重-編譯跑起來又正常啊. 但是有紅色底線就是不爽.以下為我的Support-v7的狀況

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:27.1.1 less... (⌘F1) 
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
增加了support-media-compat:27.1.1 好了嗎? 並沒有. 又跳出下面

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-v13:27.1.1 less... (⌘F1) 
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
再加.
implementation 'com.android.support:support-v13:28.0.0'
疑,好了. 再把media-compat:27.1.1移除. 也沒紅底線了.

為了釐清是不是build有暫存Build-Clean Project ,然後Rebuild Project.
再重開Android studio再Rebuild竟然修好了.


沒有留言:

轉換跑道滿5年心得

自從2014年5月開始寫Android以來一直始終如一.也滿5年了發個牢騷. 以前學生覺得電子科出來就是要做相關的工作,從生產技術員做到了小組長,生產組長. 了解生產了又怎樣.大環境真的不得不逼你要往上爬. 問題還是收入太少. 大家出來工作都是為了要賺錢.混口飯吃的嘛....