1. 程式人生 > 實用技巧 >Android Studio:Could not find any version that matches com.android.support:appcompat-v7:30.+.

Android Studio:Could not find any version that matches com.android.support:appcompat-v7:30.+.

Android build出現如標題的錯誤. 其中版本可能是30或者29.
修改報錯的build.gradle. 一般來說該檔案屬於一個module.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
//  implementation 'com.android.support:appcompat-v7:30+' 改為如下行
    implementation 'com.android.support:appcompat-v7:+'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

然後build - rebuild project. 不行的話重啟工具.

support library 最後版本為28

遷移說明 https://developer.android.google.cn/jetpack/androidx/migrate

Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.
You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android.support.*) will remain available on Google Maven. However, all new library development will occur in the AndroidX library.
We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well.