一、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:+'
, 所以具体还要看是那个依赖没确定版本号
网友评论