首页 > 解决方案 > 无法修复无法解决:androidx.appcompat:1.1.0:

问题描述

我通过制作 Android 应用程序学习 java 并且无法修复同步错误“无法解决:androidx.appcompat:1.1.0:”

项目构建文件在这里

// 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:4.0.0'

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

allprojects {
    repositories {
        google()
        jcenter()

        maven { url 'https://maven.google.com/' }
    }
}

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

应用程序构建文件在这里

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 29

        defaultConfig {
            applicationId "com.kayosystem.honki.chapter05.lesson21"
            minSdkVersion 28
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        //0608追加androidx.appcompat:appcompat:$appcompat_version
        //0608取消compile 'com.android.support:appcompat-v7:24.+'
        def appcompat_version = "1.1.0"

        implementation "androidx.appcompat:$appcompat_version"
        //For loading and tinting drawables on older versions of the platform
        implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
    }

我在项目的构建 gradle 和应用程序文件中的构建 gradle 中都有 maven。这是因为只在项目的build gradle中编写maven时出现了同步错误。

标签: androidgradle

解决方案


改变

implementation "androidx.appcompat:$appcompat_version"

implementation "androidx.appcompat:appcompat:$appcompat_version"

推荐阅读