错误:在Android Studio上更改类路径后无法解决问题

时间:2019-03-08 20:56:50

标签: android gradle android-gradle

将依赖于build.gradle的依赖项的类路径更改为3.3.2后,出现此错误:

ERROR: Failed to resolve: com.android.support:appcompat-v7:28.0.0
Show in Project Structure dialog
Affected Modules: app


ERROR: Failed to resolve: com.android.support.constraint:constraint- 
layout:1.1.3
Show in Project Structure dialog
Affected Modules: app


ERROR: Failed to resolve: com.android.support.test:runner:1.0.2
Show in Project Structure dialog
Affected Modules: app


ERROR: Failed to resolve: com.android.support.test.espresso:espresso- 
core:3.0.2
Show in Project Structure dialog
Affected Modules: app

这是我的build.gradle(Project:MyApplication)文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        //"/home/hb3hbahan1/Android-Studio/android-studio/gradle/gradle-3.3.2.pom"
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
    dependencies {

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


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {

    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是build.gradle(Module:App)文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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.gradle(Module:app)的第三行,错误消失了。那会影响我将来的调试等吗?

0 个答案:

没有答案