首页 > 解决方案 > 无法使用 Androidx Artifacts 在 Android Studio 3.3 上成功构建新项目?

问题描述

最近我将我的 android studio 3.2.1 更新到 3.3,现在我想在 android studio 3.3 中创建新的或现有的项目,但是每次我创建一个新项目时 gradle sync 都会失败

我试图解决这个问题的事情
- 从根项目中删除 .gradle 和 .idea 文件夹并重建
- 还有无效的缓存/重新启动 android studio

- 通过在 stackoverflow 上搜索应用上述解决方案,但它们都不能在这里工作

应用 Gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "xxx.xxxxx.xxxxxx"
    minSdkVersion 21
    targetSdkVersion 28
    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 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0- 
alpha4'
}

项目 Gradle

buildscript {
repositories {
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.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
}

当我构建项目时,它显示 gradle 同步失败,原因如下:

原因:org/gradle/api/publish/ivy/internal/IvyServices$BuildServices

我只想成功构建新项目或现有项目

标签: androidandroid-studioandroid-studio-3.3

解决方案


推荐阅读