AndroidStudio导入工程同步出现的问题

1、导入工程同步出现的问题描述:

ERROR: Failed to resolve: com.android.support:appcompat-v7:27.1.1
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app


WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app


WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app


WARNING: The specified Android SDK Build Tools version (23.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: app

2、解决方法:
修改module下的build.gradle,将google()放置在jcenter()之前,再次同步即可解决:
修改build.gradle前:

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

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'

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

allprojects {
    repositories {
        jcenter()
        maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
    }
}

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

修改build.gradle后:

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

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
    }
}

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

你可能感兴趣的:(android)