天天看點

Failed to resolve: com.android.support:appcompat-v7:26.1.0

更新到Android Studio 3.0.1後,建立hello world,發現報了一堆錯誤。

有台電腦網絡有點問題,用了很多方法都不能正常更新sdk的内容,導緻更新後出現一些小錯誤,這裡分享給大家。

Failed to resolve: com.android.support:appcompat-v7:26.1.0

看到這一片的提升錯誤就頭疼,不過沒關系,可以逐漸分析解決問題。提示資訊大意是指找不見app模闆下面的build.gradle檔案裡面配置的幾個依賴檔案。最上部分提示建構失敗,失敗的原因就是上面提示的那些錯誤。可以看到在dependencies裡面有添加多個implementation檔案,其中報錯的部分就是找不見框起來的内容。

其中com.android.support:appcompat-v7的内容存放的目錄在

sdk\extras\android\m2repository\com\android\support\appcompat-v7下面,打開本地目錄如下:

Failed to resolve: com.android.support:appcompat-v7:26.1.0

可以看到,确實找不見配置檔案裡面的26.1.0版本,最新的版本是26.0.0-alpha1。接下來可以通過其他途徑下載下傳對應的檔案放在目錄下,或者将配置檔案裡面的配置修改為本地有的最新版本。

我這裡是:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.0.0-alpha1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.6-alpha'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.3-alpha'
}
           

如果沒有其他問題則工程一切正常,然後就可以重新優化配置我們的開發工具了,可以參考以前分享的文章:

開發IDE大更新,終于迎來了Android Studio

簡單幾步帶你飛,運作Android Studio工程

熟悉Android Studio界面,開始裝逼賣萌

Android Studio個性化配置,打造開發利器

掌握Android Studio項目結構,揚帆起航

接着就可開始使用Android Studio 3.0進行正式開發了。

android  studio 的代碼快捷鍵

解決Android Studio運作編譯時間久的最有效方案