DEV Community

loading...

Discussion on: Dark Mode: three Lint checks to help

Collapse
dbottillo profile image
Daniele Bottillo Author

yeah I think it would totally make sense! Or even in general not just for Material guidelines, I think checking for using attributes reference instead of color reference should be a good a thing regardless!

Collapse
guilhe profile image
GuilhE

So I decided to create some lint rules just for fun and - who knows - to use them in my code template :)
I'm struggling with a detail (so I hope):

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.

dependencies {
compileOnly "com.android.tools.lint:lint-api:26.6.3"
testImplementation "com.android.tools.lint:lint-tests:26.6.3"
testImplementation "com.android.tools.lint:lint:26.6.3"
}

If I turn off android.enableJetifier it gets worst. Any idea how to solve it?
Running gradle assemble I get this:

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.)

Thanks for your time.

Thread Thread
dbottillo profile image
Daniele Bottillo Author

Hi there, I'm not exactly sure what could be the problem there. Did you try on a simple/new project from Android Studio? maybe there is some other dependency interfering!

Thread Thread
guilhe profile image
GuilhE

I've found out!
My build gradle was using apply plugin: 'com.android.library' instead of java-library '^^

Thread Thread
dbottillo profile image
Daniele Bottillo Author

nice! I'm glad you fixed it :)