安卓构建gradle失败

0 人关注

我在一个应用程序上工作了一段时间,休息了几天,现在我试图运行它,我得到了这7个失败......我试着检查编译历史,他们没有任何变化。所以我很困惑,为什么它突然就不工作了。这可能是一个很容易解决的问题,但我对安卓开发真的一无所知。

FAILURE: Build completed with 7 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
5: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
6: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:desugarDebugFileDependencies'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
7: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find android.arch.lifecycle:extensions:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/extensions/2.1.0/extensions-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
   > Could not find android.arch.lifecycle:runtime:2.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://repo.maven.apache.org/maven2/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://jcenter.bintray.com/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
       - https://cardinalcommerceprod.jfrog.io/artifactory/android/android/arch/lifecycle/runtime/2.1.0/runtime-2.1.0.pom
     Required by:
         project :app > com.paypal.checkout:android-sdk:0.2.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s

build.gradle (:app)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"
    defaultConfig {
        applicationId "###########"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    kotlinOptions {
        jvmTarget = '1.8'
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation("com.android.volley:volley:1.2.0")
    implementation 'com.google.code.gson:gson:2.8.7'
    implementation 'com.google.android.gms:play-services-location:18.0.0'
    implementation 'com.google.android.material:material:1.5.0-alpha01'
    implementation('com.paypal.checkout:android-sdk:0.2.0')

build.gradle (appname)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.5.21"
    repositories {
        google()
        mavenCentral()
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        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()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
        // This private repository is required to resolve the Cardinal SDK transitive dependency.
        maven {
            url  "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
                // Be sure to add these non-sensitive credentials in order to retrieve dependencies from
                // the private repository.
                username 'paypal_sgerritz'
                password 'AKCp8jQ8tAahqpT5JjZ4FRP2mW7GMoFZ674kGqHmupTesKeAY2G8NcmPKLuTxTGkKjDLRzDUQ'
task clean(type: Delete) {
    delete rootProject.buildDir
    
4 个评论
你是否尝试过清理然后重建?关闭并重新打开该项目?关闭并重新打开Android Studio?如果这在几天前还在工作,那么你可能是在处理Android Studio的一个错误。检查是否有依赖性问题,或者右下角是否有任何更新的提示。
诚然,@Nathan.好的评论
@NathanMeade 我甚至都不知道有这个东西,我正在尝试不同的选项,看看什么会有用!我不知道。
因此,问题显然出在PayPal的东西上,尽管它在几天前还能工作....。但当我把Paypal删除后,它就能正常工作了....。
android
android-studio
gradle
skivecore
skivecore
发布于 2021-08-18
4 个回答
Muhtasim Ulfat Tanmoy
Muhtasim Ulfat Tanmoy
发布于 2021-08-18
已采纳
0 人赞同

File -> Invalidate Cache & Restart

StillACat
StillACat
发布于 2021-08-18
0 人赞同

你也可以试着把你的代码复制并粘贴到一个新的android studio项目中,但如果没有什么变化,那可能是android studio就是android studio。也许可以尝试不使用模拟器,在你的手机上运行该应用程序。