新建一個項目,出現 Failed to resolve:com.android.support:appcompat-v7:27.+ 問題:android
android studio 中的編譯器版本與 build.gradle(app 下)不對應形成的。bash
打開 build.gradle 能夠看到錯誤的編譯器版本已被劃上了紅色波浪線:app
咱們能夠在 Project Structure → app → Dependenies 中看到編譯器的版本號:gradle
修改 build.gradle:ui
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
複製代碼
最後點擊頂部彈出框的 Sync Now 便可:spa