android - 使用 android.tools.lint 执行 JetifyTransform 失败

标签 android gradle android-gradle-plugin android-lint gradle-dependencies

项目 build.gradle :

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
    ...
}

毕业包装:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

库模块 build.gradle依赖项:
dependencies {
    compileOnly "com.android.tools.lint:lint-api:26.6.3"
//    compileOnly "com.android.tools.lint:lint-checks:26.6.3"
    testImplementation "com.android.tools.lint:lint-tests:26.6.3"
}

如果我运行 gradle assemble :

Execution failed for task ':lint-rules:compileDebugKotlin'.

Could not resolve all artifacts for configuration ':lint-rules:debugCompileClasspath'. Failed to transform artifact 'common.jar (com.android.tools:common:26.6.3)' to match attributes {artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. Execution failed for JetifyTransform: /Users/.../.gradle/caches/modules-2/files-2.1/com.android.tools/common/26.6.3/660d537bd70cc816f63b4b038a529177f402448a/common-26.6.3.jar. Failed to transform '/Users/.../.gradle/caches/modules-2/files-2.1/com.android.tools/common/26.6.3/660d537bd70cc816f63b4b038a529177f402448a/common-26.6.3.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)



如果我取消注释 lint-checks导入它添加:

Failed to transform '/Users/.../.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-checks/26.6.3/aa1f7a4caa8cbc70f85e4c97409270ce7d7a7eab/lint-checks-26.6.3.jar' using Jetifier. Reason: duplicate entry: NOTICE. (Run with --stacktrace for more details.)



我试图禁用 Jetifier,但这是最糟糕的。我试图从 lint 中排除 tools:common 并手动导入,但它也不起作用。

我被困在这里,我错过了什么?

最佳答案

我发现了问题,我的 build.gradle 正在使用 apply plugin: 'com.android.library'而不是 java-library '^^

关于android - 使用 android.tools.lint 执行 JetifyTransform 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61574378/

相关文章:

android - 如何将JAR依赖项包含到上述AAR库gradle 3.0中

android - Gradle compileOnly和Maven提供

android - Gradle buildscript中类路径的用途是什么

android - 无法解析符号 fragment 容器

android - 如何将数据库打印为表格? (安卓,SQLite)

android - 确定 GPS 是否无法锁定

android - "android:colorBackground"的含义/用法

java - Android Studio 1.0.2 m2respository gradle 问题

java - STS/Eclipse错误:从插件调用代码时出现问题: “org.eclipse.core.resources”

android - google-services-auth 因通讯而崩溃