错误:找不到:com.android.support:support-v4:20.0.+

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25890015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:48:01  来源:igfitidea点击:

Error : Failed to find: com.android.support:support-v4:20.0.+

androidgradleandroid-studioandroid-gradle-plugin

提问by N Sharma

I have imported a project in Android Studio that was built in it. I require v4 and v7 library in the project. This is how my build.gradle looks like

我在其中内置的 Android Studio 中导入了一个项目。我在项目中需要 v4 和 v7 库。这就是我的 build.gradle 的样子

build.gradle

构建.gradle

apply plugin: 'android-library'

android {
    compileSdkVersion 19
    buildToolsVersion '20'
    defaultConfig {
        applicationId 'com.example.sdk'
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.+'
    compile 'com.android.support:support-v4:20.0.+'
}

When I sync with gradle then it always gives error message

当我与 gradle 同步时,它总是给出错误消息

Failed to find: com.android.support:support-v4:20.0.+ & Failed to find: com.android.support:appcompat-v7:20.0.+

找不到:com.android.support:support-v4:20.0.+ & 找不到:com.android.support:appcompat-v7:20.0.+

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Please support & thanks in advance.

请提前支持和感谢。

回答by Bijesh P V

The Androidsupport repository was missing,So go to Android SDK, install the Android Support Repositoryand Android Support Library. Also you can use the following

Android支持库已丢失,因此去Android SDK,安装Android Support RepositoryAndroid Support Library。您也可以使用以下

compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'

instead of

代替

compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'

回答by zhiwen zhang

Note: If you're developing with Android Studio, select and install the Android Support Repository item instead.

注意:如果您使用 Android Studio 进行开发,请改为选择并安装 Android Support Repository 项。

see here.

看到这里

回答by Kishan Vaghela

From Android Studio go to: Tools >> Android >> SDK Manager

从 Android Studio 转到:工具 >> Android >> SDK 管理器

Select and install "Extras|Android Support Repository"

选择并安装“Extras|Android Support Repository”

回答by Raafat Alhmidi

add maven to your gradle file (project)

将 maven 添加到您的 gradle 文件(项目)

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

and use this gradle wrapper:

并使用此 gradle 包装器:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

and downgrade to gradle plugin to be 2.3.1

并将gradle插件降级为2.3.1

classpath 'com.android.tools.build:gradle:2.3.1'