Home > other >  Gradle: Test Java library on Android
Gradle: Test Java library on Android

Time:02-21

(I asked a similar question earlier, so I'll try a more general form and see if anybody knows how to do that.) There's a Java library to which I have added patches for Android support. I would like to automate testing of the code, but in order to check if it runs properly on Android, I need to test it on Android. The library artifact is a jar, though, not an AAR or an APK, so I don't want to remove the old build modes, and so far my attempts to add the Gradle Android Plugin yields errors like The 'java' plugin has been applied, but it is not compatible with the Android plugins.

How can I continue to produce a plain Java jar, but also automatically test it on Android? Do I need to, like, make a new submodule or something specifically for the tests?

CodePudding user response:

Yes, usually it's a good practice to create a new module, say integration-tests, which in itself is an android library/app, and then you'd include your JAR/java lib in there and run android tests over it.

  • Related