android studio 3.2无法解决':app @ debug / compileClasspath'的依赖项:无法解决com.android.support:appcompat-v7:27.1.1

时间:2018-09-27 08:19:53

标签: android android-studio gradle gradle-dependencies appcompat-v7

我正在使用android studio 3.2,并且在使用此软件之前先安装了android studio 2.2。当我打开一个新项目时,出现以下错误。我想再次提到,我没有对布局或main.activity进行任何更改。我已经检查了旧版本的解决方案,但是问题仍然存在。这是我以前尝试过的:

更改应用插件:“ com.android.application”以应用插件:“ com.android.library” -取消选中离线模式。 -添加存储库:

mavenCentral()
        maven {
            url "https://maven.google.com"
    }

-将appcompat更改为旧版本(v7:26+或v7:25) 这是错误的日志:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.0.1.
Open File
Show Details


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2.
Open File
Show Details


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test.espresso:espresso-core:3.0.2.
Open File
Show Details


Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.0.1.
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.0.1.
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve junit:junit:4.12.
Open File
Show Details


Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.0.1.
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.0.1.
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve junit:junit:4.12.
Open File
Show Details

->我的gradle.wrapper.properties

#Thu Sep 27 09:39:31 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists zipStoreBase\=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip

->我的build.gradle(app)

apply plugin: 'com.android.application'

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

    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    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(项目)

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

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'


        // 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
}

我真的很难在2天的时间里浏览解决方案,我真的很失落。感谢您的时间,关注和预先的帮助。

2 个答案:

答案 0 :(得分:1)

尝试这种方式

1)Android Studio const components = { Default, Test } axios.get( `${process.env.VUE_APP_API_DOMAIN}/wp-json/api/v1/routes`).then( r => r.data ).then(routes => { routes.pages.forEach( (e) => { router.addRoutes([ { path: `/${e.slug}`, component: components[e.template], }, ]); }); });

2)

3.1.4

3)

  

build.gradle {项目}

COMPILE_SDK_VERSION=26
BUILD_TOOLS_VERSION=27.0.3
TARGET_SDK_VERSION=26

4)支持库版本应该相同,您可以使用buildscript { repositories { jcenter() google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' } } allprojects { repositories { jcenter() google() mavenCentral() } } 进行上述配置,例如26.1.0

5),最后一步是

  

gradle-wrapper.properties

com.android.support:appcompat-v7:26.1.0

答案 1 :(得分:0)

我删除了与“ Android Studio”相关的所有文件,包括.gradle文件和SDK文件。然后,我安装了Android Studio 2.2.1,它可以正常工作。我遇到的可能是关于Android 2.2.1的其余部分。我不确定,但是也许我应该在安装新版本之前删除有关Android Studio的所有内容。 现在,我正在使用2.2.1版。希望对尝试将其Android Studio升级到新版本的人有所帮助。