2017-11-30

【Android Studio】Conflict with dependency 'com.android.support:support-annotations'

Android Studio 版本:3.0.1

想寫一個新的 app,因為覺得現在還在用 HoneyComb(Android3.2, API13) ,甚至更舊的版本的人應該極少了,所以新的專案不想再與 appcompat-v7 相容,在建立新專案的精靈就把 Backwards Compatibility(AppCompat) 打勾取消



但在加入 adMob 套件,按下右上角的 Sync 時就出現錯誤!!




Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.2.0) and test app (25.4.0) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.


 
dependencies {
...
...
    // 加入這行就 ok 了
    implementation 'com.android.support:appcompat-v7:26.1.0'

    compile 'com.google.android.gms:play-services-ads:11.6.0'
}