android - 无法在使用 androidx 的项目构建中使用 Arr 库
问题描述
我已将我的项目迁移到 androidx。我的项目依赖于一些第三方库,我在我的项目中使用了一个 arr 文件。迁移后,我收到如下错误。
无法解析“:app@debug/compileClasspath”的依赖关系:无法使用转换 JetifyTransform 转换文件“csjsdk-beta.aar”以匹配属性 {artifactType=processed-aar} 显示详细信息 受影响的模块:csjsdkdemo-app
这是应用程序级别的gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.demo.csjbot.csjsdkdemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
// 将 jniLib 指向 libs
jniLibs.srcDir 'libs'
}
}
repositories {
flatDir {
dirs 'libs'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:1.1.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation(name: 'csjsdk-beta', ext: 'aar')
implementation 'io.netty:netty-all:4.1.23.Final'
implementation 'com.google.code.gson:gson:2.8.1'
}
谁可以帮我这个事?
解决方案
尝试清除应该存储在此处的 gradle 缓存:C:\Users\<username>\.gradle\caches\transforms-1
,然后重建项目。
编辑:
更改您的依赖build.gradle
项以使用 AndroidX 命名空间:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:1.1.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation(name: 'csjsdk-beta', ext: 'aar')
implementation 'io.netty:netty-all:4.1.23.Final'
implementation 'com.google.code.gson:gson:2.8.1'
推荐阅读
- javascript - 从 js 视图调用 get 函数
- elasticsearch - Nest - 弹性搜索 - 查找不区分大小写的子字符串,允许使用斜杠
- excel - 无法将 CSV 文件保存在共享点文件夹中
- regex - 尝试创建一个正则表达式来切换 2 个字符与 4 个其他字符除以 / 字符
- python - 使用python添加特定增加四分之一的新列
- ruby-on-rails - 带有 PostGIS 的 Rails - LineString 不会超过 -90 度
- java - Commons Configuration + Spring:重新加载配置
- machine-learning - 了解 Apache Mahout Clusterdump 输出
- r - 根据R中另一个中的键值替换数据库中的文本
- android - 即使所有 textview r 为空,程序也不会进入第一个 if 语句