我已将项目迁移到androidx。我的项目依赖于某些第三方库,我在项目中使用了一个arr文件。迁移后,出现如下错误。
无法解决':app @ debug / compileClasspath'的依赖关系:失败 转换文件“ csjsdk-beta.aar”以匹配属性 {artifactType = processed-aar}使用转换JetifyTransform显示 受影响的模块的详细信息: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'
}
有人可以帮我吗?
答案 0 :(得分:0)
尝试清除应存储在此处的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'
答案 1 :(得分:0)
迁移到Android X后,您需要执行一些步骤以清除所有未使用的导入。
要清除所有这些未使用的进口商品:-
右键单击src:-您将获得“优化导入”选项 一旦完成优化。在github中查看所有更改。
如果仍然遇到同样的问题。 关闭项目。再次重新导入该项目。