Android Library打包成aar错误相关

一、library库本身引用了aar文件

1.具体报错如下

> Direct local .aar file dependencies are not supported when building 
an AAR. The resulting AAR would be broken because the classes 
and Android resources from any local .aar file dependencies would 
not be packaged in the resulting AAR. Previous versions of the 
Android Gradle Plugin produce broken AARs in this case too (despite 
not throwing this error). The following direct local .aar file 
dependencies of the :jsbridge-android project caused this error: 
/Users/qushaohua/Desktop/new_project/jsbridge-android/libs/api-
2.1.9.aar

2.错误原因是一下代码导致

dependencies {
    、、、
    implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
   、、、
}

3.解决方法
以上代码是为了使用libr中sdk相关。更改配置方式

dependencies {
    compileOnly fileTree(dir: "libs", include: ["*.jar", "*.aar"])
}

二、依赖第三库没有没有确定版本号

1.具体报错

ERROR:/Users/qushaohua/.gradle/caches/transforms-2/files-
2.1/f7b2afe1097d2339d93e935a6aeab305/core-
1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource 
android:attr/lStar not found.

2.解决方法
在工程中app/build.gradle中的dependecies中添加如下代码:

dependencies {
    
    configurations.all {
        resolutionStrategy {
            force 'androidx.core:core:1.6.0'
            force 'androidx.core:core-ktx:1.6.0'
        }
    }
}

主要引起原因,是我们引入依赖库后面带“+”的,没有指定确定固定版本号,例如上面是implementation 'androidx.core:core-ktx:+', 所以具体还要看是那个依赖没确定版本号

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容