Nice post!
Another cool check, for projects following Material guidelines, would be avoiding using color resources instead of attributes, for instance: android:textColor="@color/black" instead of android:textColor="?android:textColorPrimary".
This would apply to layouts, drawables, colors and styles files.
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!
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.
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.)
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!
Nice post!
Another cool check, for projects following Material guidelines, would be avoiding using color resources instead of attributes, for instance:
android:textColor="@color/black"
instead ofandroid:textColor="?android:textColorPrimary"
.This would apply to layouts, drawables, colors and styles files.
What do you think? :)
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!
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):
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'.
Thanks for your time.
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!
I've found out!
My build gradle was using apply plugin: 'com.android.library' instead of java-library '^^
nice! I'm glad you fixed it :)