Android Studio升级后,编译出错FAILURE: Build completed with 3 failures.

出错信息如下:

Executing tasks: [:app:assembleDebug] in project D:\AndroidStudioProjects\checkinsys

> Task :app:preBuild UP-TO-DATE

> Task :identify:preBuild UP-TO-DATE

> Task :identify:preDebugBuild UP-TO-DATE

> Task :identify:checkDebugManifest FAILED

> Task :identify:compileDebugAidl NO-SOURCE

> Task :identify:packageDebugRenderscript NO-SOURCE

> Task :app:prepareLintJar UP-TO-DATE

> Task :identify:compileDebugRenderscript NO-SOURCE

> Task :identify:generateDebugResValues UP-TO-DATE

> Task :identify:generateDebugResources UP-TO-DATE

> Task :identify:packageDebugResources UP-TO-DATE

> Task :identify:prepareLintJar UP-TO-DATE

> Task :identify:javaPreCompileDebug UP-TO-DATE

> Task :identify:mergeDebugShaders UP-TO-DATE

> Task :identify:compileDebugShaders FAILED

> Task :identify:processDebugJavaRes NO-SOURCE

> Task :identify:mergeDebugJniLibFolders UP-TO-DATE

> Task :identify:transformNativeLibsWithMergeJniLibsForDebug FAILED

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.

———–

* What went wrong:

A problem was found with the configuration of task ‘:identify:checkDebugManifest’ (type ‘CheckManifest’).

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.internal.tasks.CheckManifest’ property ‘manifest’ has @Input annotation used on property of type ‘File’.

    

    Reason: A property of type ‘File’ annotated with @Input cannot determine how to interpret the file.

    

    Possible solutions:

      1. Annotate with @InputFile for regular files.

      2. Annotate with @InputDirectory for directories.

      3. If you want to track the path, return File.absolutePath as a String and keep @Input.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.

* 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:

A problem was found with the configuration of task ‘:identify:compileDebugShaders’ (type ‘ShaderCompile’).

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.tasks.ShaderCompile’ property ‘sourceDir’ is annotated with @InputFiles but missing a normalization strategy.

    

    Reason: If you don’t declare the normalization, outputs can’t be re-used between machines or locations on the same machine, therefore caching efficiency drops significantly.

    

    Possible solution: Declare the normalization strategy by annotating the property with either @PathSensitive, @Classpath or @CompileClasspath.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_normalization_annotation for more details about this problem.

* 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:

Some problems were found with the configuration of task ‘:identify:transformNativeLibsWithMergeJniLibsForDebug’ (type ‘TransformTask’).

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.internal.pipeline.TransformTask’ property ‘allSecondaryInputs’ is private and annotated with @Internal.

    

    Reason: Annotations on private getters are ignored.

    

    Possible solutions:

      1. Make the getter public.

      2. Annotate the public version of the getter.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#private_getter_must_not_be_annotated for more details about this problem.

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.internal.pipeline.TransformTask’ property ‘logging’ is missing an input or output annotation.

    

    Reason: A property without annotation isn’t considered during up-to-date checking.

    

    Possible solutions:

      1. Add an input or output annotation.

      2. Mark it as @Internal.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation for more details about this problem.

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.internal.pipeline.TransformTask’ property ‘oldSecondaryInputs’ is annotated with @InputFiles but missing a normalization strategy.

    

    Reason: If you don’t declare the normalization, outputs can’t be re-used between machines or locations on the same machine, therefore caching efficiency drops significantly.

    

    Possible solution: Declare the normalization strategy by annotating the property with either @PathSensitive, @Classpath or @CompileClasspath.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_normalization_annotation for more details about this problem.

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.internal.pipeline.TransformTask’ property ‘path’ is missing an input or output annotation.

    

    Reason: A property without annotation isn’t considered during up-to-date checking.

    

    Possible solutions:

      1. Add an input or output annotation.

      2. Mark it as @Internal.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation for more details about this problem.

  – In plugin ‘com.android.build.gradle.api.AndroidBasePlugin’ type ‘com.android.build.gradle.internal.pipeline.TransformTask’ property ‘temporaryDir’ is missing an input or output annotation.

    

    Reason: A property without annotation isn’t considered during up-to-date checking.

    

    Possible solutions:

      1. Add an input or output annotation.

      2. Mark it as @Internal.

    

    Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation for more details about this problem.

* 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.

You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s

10 actionable tasks: 3 executed, 7 up-to-date

网上参考,查找原因,是compile Sdk Version与Build Tools Version不匹配导致。

按下图修改:

Android Studio升级后,编译出错FAILURE: Build completed with 3 failures. 

重新编译,问题解决。

> Task :prepareKotlinBuildScriptModel UP-TO-DATE

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3s

参考文章:Android Studio Gradle 适配 Android 11 升级出错了_a property of type ‘file’ annotated with @input ca-CSDN博客

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/fa4ee3f99d.html