Error:Artifact 'support-v4.jar (com.android.su

2019-03-03 02:47发布

问题:

I did a new install of Android Studio 1.0.2. Getting the following error when opening my first existing android project:

Gradle 'MyApplication' project refresh failed

Error:Artifact 'support-v4.jar (com.android.support:support-v4:21.0.3)' not found.

Searched in the following locations: file:/C:/Users/Ntokozo/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar

And if I navigate to that searched location I found two jar files which are: support-v4-21.0.3-sources.jar and support-v4-21.0.3-javadoc.jar

Here is my build.gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Gradle file under App folder:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.ntokozo.myapplication"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

Thank you in advance, please bare in mind in responses that I'm a novice and I might not know advanced features.

回答1:

After re-installing windows OS and a new Android Studio setup the problem disappeared. I don't know what was the problem at first.