-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add android projects support (documentation is a bit misleading) #8
Comments
Hi! Indeed seems to be misleading. My point was not to use for android projects, but check java projects apis for compatibility with android (for dual targeted libs). I never develop for android (never interested in it) and wasn't aware that android plugin did not use JavaPlugin. Now, when I know, I will look this point (but only when have time, after other projects). And, of course, I would appreciate any help. It should not be difficult: animalsniffer just needs compiled class files and source files paths. If android plugin use source sets the same way as java plugin (it should) then almost everything should work already. The only problem could be if android plugin did not use classes task (which plugin use to make sure all sources are compiled), but it would be easy so solve too. |
Much of the Android toolchain doesn't make much sense and breaks everything ever made for Gradle, sadly. They also reinvented JAR resource packaging (AAR) because they didn't like
I might send you a PR if I can create some time for that soon. |
FWIW we are using animalsniffer for Android checks in OkHttp by checking against a test android jar. It seems to mostly work. But unfortunately updating this test jar from API 28 to 29 triggers a bug below. |
I'm almost sure that it's caused by old asm version (7.0). The latest asm is 7.2. Asm is shaded inside ant tasks jar and so it could be updated only with new animalsniffer release. I did not found any confirmations (with a quick googling) that asm 7.2 will work... but the probability is high. You can try to check it by either searching for proof or manually: update asm version in local animalsniffer, publish it into local maven repo and then try to use it with gradle plugin. In case if new asm would indeed help, it would be possible to do a pull request into animalsniffer (with proof that fix is required) and, maybe, new fixed version would be released much sooner then. |
I tried to add direct android support, but andoid studio api is weird - api that everyone used (BaseVariant) is deprecated and it's not clear what should be used instead. Don't think it is a good idea to use deprecated apis. Also, there is a strange mess of sourcesets and variants (very strange api). The best sourceset-based android plugin implementation I have seen is freefair plugin and I can re-use this approach, but it's based on depreacted api. To avoid redundant work, please, If anyone still need native android support comment here so I could know anyone need this. And it would be great if someone who knows about android gradle api changes would consult me (maybe just showed some plugin using new api - a new shiny way of getting source paths and compilation targets). |
@jcayzac, is it not actual anymore? |
@xvik probably not? animal-sniffer being deprecated and all that. |
It's officially in maintenance mode, but there is no alternative for it in general (only for jdk checks). |
Hi! I've created this PR to add support for android lib projects. The android gradle plugin has gotten a bit more stable since its version |
Hi,
The mention of the Android signatures in the documentation raises hopes that this plugin works in Android projects, which it does not. I think this should probably be mentioned somewhere in bold characters.
Alternatively, is there anything stopping animal sniffer from working with the Android plugin? If not, I can try and have a look at it when I have some time.
The text was updated successfully, but these errors were encountered: