Reputation: 12497
I'm getting the following Lint error on Github Actions (current CI solution for the project)
> Task :application:lint FAILED
Ran lint on variant debug: 1 issues found
Ran lint on variant release: 1 issues found
Wrote HTML report to file:///~/application/build/reports/lint/lint-results.html
64 actionable tasks: 55 executed, 9 from cache
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':application:lint'.
> Lint found errors in the project; aborting build.
android {
lintOptions {
abortOnError false
}
}
...
Errors found:
~/application/build.gradle.kts:17: Error: Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details. [OldTargetApi]
targetSdkVersion(29)
~~
My targetSdkVersion
is set to 29
already.
If I run the exact same command locally ( ./gradlew build
), no lint error is reported.
Some local environment data:
Any ideas on why this supposedly "contained" build is resulting in different outputs?
Upvotes: 6
Views: 1731
Reputation: 212
This happens when you update your Android build tool chain to the latest version. Most likely your CI runner instances are set to always download the latest tools. Once the next version of the build tool chain is installed, it expects you to be targeting that version of the Android API.
So the solution would be to add an ignore for OldTargetAPI
in your lint.xml
like @dmytro-karataiev mentions or just don't update your build tool chain until you're ready to target the latest Android API.
Upvotes: 1
Reputation: 1304
Not a proper solution, just a temporary workaround if you don't want to disable lint checks.
Create a lint.xml
file in your app
folder and list your build.gradle file to be ignored by lint:
<lint>
<issue id="OldTargetApi">
<ignore path="build.gradle"/>
</issue>
</lint>
Upvotes: 4