안드로이드 스튜디오에서 학년 동기화에 문제가

Siavash R :

내가 동기화하고 할 때 grade나는 다음과 같은 메시지를 받았습니다 :

오후 1시 9분 Gradle을 동기화 실패 : com.android.tools.build:gradle:3.6.1를 찾을 수 없습니다. 다음 위치에서 검색 : - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom - https : //로 DL .google.com에 / ㎗ / 안드로이드 / maven2 / COM / 안드로이드 / 도구 / 빌드 / Gradle을 / 3.6.1 / Gradle을-3.6.1.jar - https://repo.maven.apache.org/maven2/com/android /tools/build/gradle/3.6.1/gradle-3.6.1.pom - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6 .1.jar - https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom - https://jcenter.bintray.com/com/android /tools/build/gradle/3.6.1/gradle-3.6.1.jar 프로젝트 :에 필요한 자세한 내용은 IDE 로그 문의 (도움말 | 로그보기) (24의 360 밀리 초)

여기 내 build.gradle 파일입니다

buildscript {

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

그리고, 또한 내 gradle-wrapper.properties파일이 동일 아래와 같이 같습니다 :

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
MohammadMoeinGolchin :

이 시도:

build.gradle (프로젝트)의 경우 :

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

buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // 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 (모듈)의 경우 :

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.example.mytestapplication"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.core:core:1.3.0-alpha02'
    implementation 'androidx.mediarouter:mediarouter:1.1.0'
}

추천

출처http://43.154.161.224:23101/article/api/json?id=320316&siteId=1