Welcome to gradle animalsniffer plugin¶
Use AnimalSniffer signatures to check (JDK, android SDK or any library) API compatibility for java (kotlin, scala, groovy etc.), android and kotlin multiplatform projects.
Release notes - History - Compatibility - License
Used by:
- Mockito for java and android compatibility checks
- Okhttp for java and android compatibility checks (using kotlin multiplatform)
- Open-telemetry for android compatibility checks (with custom (gammy-bears based) signatures generation)
Overview¶
Initially, AnimalSniffer was created to check compatibility with lower Java versions (to prevent situations when newer API methods called).
But it's a general tool: signatures could be created for any library to check api compatibility against older library versions. For example, android community adopted it for android SDK compatibility verification.
Easy way to check android SDK compatibility for java library.
JDK signatures for java 9 and above
JDK 9+ signatures are not published due to module nature: use --release flag instead of plugin
compileJava {
options.release = 11
}
Use plugin for java 8 and before checks, for android or any other library signatures verification.
Features¶
- Works with:
- Java (and related) plugins: java (java-library), kotlin, groovy (only with
@CompileStatic
), scala, or any other jvm language (which plugin use sourceSets) - Android projects (library and application plugins)
- Kotlin multiplatform projects
- Java (and related) plugins: java (java-library), kotlin, groovy (only with
- Could create signatures for your or any 3rd party library (to check compatibility against the older library version)
- Special task to view signature file contents
- Report errors to console (to simplify reaction), text file and CSV (for external tools)
- Could merge existing signatures (e.g. for caching)
- Compatible with gradle configuration cache (gradle 9+ requirement)
- Debug tools to learn or check configuration
Example projects¶
Check:
- Java (including android signatures)
- Groovy
- Kotlin
- Scala
- Android library
- Android application
- Multiplatform
- Multiplatform + android
Signature build:
- Classes - signature from project classes
- Jars - signature from project jars (configuration)
- Signatures - signature from other signatures
- Mixed - signature from different sources
Full android and multiplatform projects (created with android studio and kotlin init site):
- Android - complete android project
- Multiplatform: android only - 1 multiplatform target
- Multiplatform: android, desktop, server - several multiplatform targets
- Multiplatform: desktop, server - 2 targets, without android