uni-app项目中com.google.errorprone:error_prone_annotations:2.15.0是什么?项目里根本没有,为啥会冲突

发布于 1周前 作者 eggper 来自 Uni-App

uni-app项目中com.google.errorprone:error_prone_annotations:2.15.0是什么?项目里根本没有,为啥会冲突

Appid: UNI8582AD0  

### 错误解决方案

错误描述: App原生语言插件/uts插件 依赖的三方库冲突  
解决方案: 请根据错误信息修改 App原生语言插件/uts插件 依赖的三方库或联系插件作者解决。  

FAILURE: Build failed with an exception.


Duplicate class com.google.errorprone.annotations.CanIgnoreReturnValue found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.CheckReturnValue found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.CompatibleWith found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.CompileTimeConstant found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.DoNotCall found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.DoNotMock found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.ForOverride found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.FormatMethod found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.FormatString found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.Immutable found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.IncompatibleModifiers found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.InlineMe found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.InlineMeValidationDisabled found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.Modifier found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.MustBeClosed found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.NoAllocation found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.RequiredModifiers found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.RestrictedApi found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.SuppressPackageLocation found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.Var found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.concurrent.GuardedBy found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.concurrent.LazyInit found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.concurrent.LockMethod found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar) Duplicate class com.google.errorprone.annotations.concurrent.UnlockMethod found in modules jetified-error_prone_annotations-2.15.0 (com.google.errorprone:error_prone_annotations:2.15.0) and jetified-error_prone_annotations-2.9.0 (error_prone_annotations-2.9.0.jar)


Go to the documentation to learn how to Fix dependency resolution errors.  

Try:  

- Run with --debug option to get more log output.
- Run with --scan to get full insights.
- Get more help at https://help.gradle.org.  

Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:checkReleaseDuplicateClasses'.
...

1 回复

在uni-app项目中遇到关于com.google.errorprone:error_prone_annotations:2.15.0的冲突问题,通常是因为项目依赖中某些库间接引入了该依赖。尽管uni-app本身是基于Vue.js开发多端应用的框架,不直接涉及Java或Android依赖管理(如Maven或Gradle),但如果你在使用uni-app开发Android平台应用,或者项目中有使用到某些原生插件、SDK,这些组件可能会引入Java依赖。

分析原因

  1. 间接依赖:你的项目中可能直接依赖了一个库A,而库A又依赖了com.google.errorprone:error_prone_annotations。当多个库依赖了不同版本的同一个库时,就可能发生冲突。

  2. 插件或模块:uni-app项目中的某些原生插件或模块可能使用了Java依赖,这些依赖可能间接引入了error_prone_annotations

解决方法

为了解决这个问题,你可以尝试以下方法,这里以Gradle为例(如果你在使用Android Studio或其他基于Gradle的构建工具):

  1. 强制统一版本: 在项目的build.gradle文件中,可以添加以下配置来强制所有依赖使用相同版本的error_prone_annotations

    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if (details.requested.group == 'com.google.errorprone') {
                details.useVersion '2.15.0' // 或者你希望统一使用的版本
            }
        }
    }
    
  2. 排除特定依赖: 如果确定某个依赖引入了不必要的error_prone_annotations,可以在依赖声明中排除它:

    dependencies {
        implementation('some-library:1.0.0') {
            exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
        }
    }
    
  3. 检查并更新依赖: 确保所有依赖都是最新的,或者至少是兼容的版本,有时候更新到最新版本可以解决依赖冲突问题。

注意

上述解决方案假设你正在处理一个包含Android原生代码或依赖的uni-app项目。如果你的uni-app项目纯粹是基于前端技术栈(HTML/CSS/JavaScript/Vue.js),那么这个问题可能与你的构建环境或某些特定配置有关,需要进一步检查项目的构建脚本和配置文件。

希望这些信息能帮助你解决依赖冲突问题。

回到顶部