Skip to content
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

Open
jcayzac opened this issue Jun 27, 2018 · 9 comments
Open

Add android projects support (documentation is a bit misleading) #8

jcayzac opened this issue Jun 27, 2018 · 9 comments

Comments

@jcayzac
Copy link

jcayzac commented Jun 27, 2018

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.

@xvik
Copy link
Owner

xvik commented Jun 27, 2018

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.

@xvik xvik changed the title Documentation is a bit misleading Add android projects support (documentation is a bit misleading) Jun 27, 2018
@jcayzac
Copy link
Author

jcayzac commented Jun 27, 2018

I wasn't aware that android plugin did not use JavaPlugin

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 META-INF or something… 😬

I would appreciate any help

I might send you a PR if I can create some time for that soon.

@yschimke
Copy link

yschimke commented Oct 4, 2019

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.

mojohaus/animal-sniffer#70

@xvik
Copy link
Owner

xvik commented Oct 4, 2019

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.

@xvik
Copy link
Owner

xvik commented Aug 19, 2022

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 jcayzac closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2023
@xvik
Copy link
Owner

xvik commented May 16, 2023

@jcayzac, is it not actual anymore?

@jcayzac
Copy link
Author

jcayzac commented May 16, 2023

@xvik probably not? animal-sniffer being deprecated and all that.

@xvik
Copy link
Owner

xvik commented May 16, 2023

It's officially in maintenance mode, but there is no alternative for it in general (only for jdk checks).
Last animalsniffer release was just 2 month ago.

@LikeTheSalad
Copy link
Contributor

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 7.4.0 so that'd be the only requirement for a consumer project, to use at least that version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants