且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

找不到com.android.support:appcompat-v7:25.3.1

更新时间:2021-09-16 05:29:53

我在android项目上遇到了相同的问题( appcompat-v7:25.3.1 ),但没有使用react

I've had the same problem (appcompat-v7:25.3.1), on an android project, but not using react.

我首先尝试清理gradle缓存(〜/.gradle/caches),如解释的在这里,但没有帮助.

I first tried to clean the gradle cache (~/.gradle/caches), like explained here, but it didn't help.

然后,我查看了SDK Manager.
Android支持库通常是通过sdkmanager安装的. 然后将这些库存储在本地Maven存储库:<SDK_HOME>/sdk/extras/android/m2repository/中.

Then I looked at the SDK Manager.
Android Support libraries are normally installed via sdkmanager. The libraries are then stored in a local maven repository : <SDK_HOME>/sdk/extras/android/m2repository/.

例如,对于appcompat-v7,安装的版本列表在<SDK_HOME>/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml中.
因此,对于 Android支持存储库(修订版:47.0.0),其最新版本通常为 25.3.1 .

For example, for appcompat-v7 the list of versions installed is in <SDK_HOME>/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml.
So, for the Android Support Repository (revision: 47.0.0), the last version was normally 25.3.1.

要解决我的问题,我必须通过SDK Manager 卸载 Android支持存储库,然后重新安装.

To fix my problem, I had to uninstall the Android Support Repository via the SDK Manager, then reinstall it.

我还找到了另一种获取支持库的方法:远程获取. 在这里阅读后( https://developer.android.com/topic/libraries/support-library/setup.html#add-library )并像这样修改<PROJECT_ROOT>/build.gradle:

I also found another way to fetch support libraries : remotely. After reading here (https://developer.android.com/topic/libraries/support-library/setup.html#add-library) and modifying <PROJECT_ROOT>/build.gradle like this :

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

然后我尝试使用不在本地maven存储库中的更新版本的 appcompat-v7:25.4.0 . 该库的该Google Maven存储库版本列表可在以下位置找到:

Then I tried to use a newer version of appcompat-v7:25.4.0 that was not in my local maven repository, and it worked !
The list of this Google Maven repository's versions of this library can be seen there : https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/maven-metadata.xml.