uni-app x下uts插件添加android依赖后报错

uni-app x下uts插件添加android依赖后报错

项目信息 详情
产品分类 uniapp/App
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 22621.1992
HBuilderX类型 Alpha
HBuilderX版本号 3.93
手机系统 Android
手机系统版本号 Android 13
手机厂商 vivo
手机机型 Y77e
页面类型 vue
vue版本 vue3
打包方式 云端
项目创建方式 HBuilderX

操作步骤:

  1. 创建一个uni-app x项目
  2. 创建一个uts插件
  3. 为该插件添加依赖(Android)
  4. 真机运行/云打包

预期结果:

正常运行

实际结果:

报错信息如上

bug描述:

如题,编写的uts插件,添加了android依赖之后,在uni-app正常运行,而在uni-app x下无论是真机运行还是云打包都报错:

uni_module [****] Error:   
FAILURE: Build failed with an exception.  

* What went wrong:  
  Execution failed for task ':androidDependencies'.  

> Failed to notify dependency resolution listener.  
> Failed to notify dependency resolution listener.  
> 'void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)'  
> 'void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)'  

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

BUILD FAILED in 14s

以下为uts组件app-android/config.json文件内容:

{
    "dependencies": [ 
        {
            "id": "GSLS_Tool",
            "source": "implementation 'com.github.1079374315:GSLS_Tool:v1.4.4.9'"
        },
        {
            "id": "GSLS_Tool_annotationProcessor",
            "source": "annotationProcessor 'com.github.1079374315:GSLS_Tool:v1.4.4.9'"
        }
    ],
    "minSdkVersion": 21,
    "project": {
        "plugins": [
            "kotlin-kapt"
        ]
    }
}

更多关于uni-app x下uts插件添加android依赖后报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复

请提供下云端打包的完整错误日志链接。

更多关于uni-app x下uts插件添加android依赖后报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这个错误是由于Gradle版本兼容性问题导致的。uni-app x项目使用的Gradle版本可能与你添加的依赖库要求的Gradle版本不匹配。

解决方案如下:

  1. 检查你的Gradle版本是否与依赖库兼容。uni-app x目前使用的是Gradle 7.x版本。

  2. 尝试修改config.json文件,简化依赖声明:

{
    "dependencies": [
        {
            "id": "GSLS_Tool",
            "source": "implementation 'com.github.1079374315:GSLS_Tool:v1.4.4.9'"
        }
    ],
    "minSdkVersion": 21
}
回到顶部