Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven-Plugin for checking API-Compliance with Android

I'm looking for a Maven-Plugin that can check Jar/Class-Files for compliance with a specified API Level of Android. E.g. can all Classes and Methods be resolved in the Android API..
Does someone know about such a plugin? The DX tool doesn't seem to provide such functionality or am I missing something?

Use case:
I wrote some Jar-Files which should be used in Desktop-Java-Applications as well in Android-Apps. Now I want to make sure that these Jar-Files are compliant to the Android API of a certain level.

My current workaround would be to run my Unit-Tests in an Android-Emulator.

like image 870
Marc-Christian Schulze Avatar asked Jul 05 '26 04:07

Marc-Christian Schulze


1 Answers

You can use animal-sniffer-maven-plugin with android-api-level signatures.

This will looks like :

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>animal-sniffer-maven-plugin</artifactId>
    <version>1.16</version>
    <configuration>
        <signature>
            <groupId>net.sf.androidscents.signature</groupId>
            <artifactId>android-api-level-19</artifactId>
            <version>4.4_r1</version>
        </signature>
    </configuration>
</plugin>

See animal-sniffer-maven-plugin for more details.

More resources about android level API :

  • android version history,
  • usage statistics.
like image 199
sbernard Avatar answered Jul 06 '26 17:07

sbernard