当用户添加gradle依赖项时如何使我的Android库源代码可见(因此不必在Android Studio中反编译代码) [英] How to make my Android library source code visible when a user adds the gradle dependency (so code doesn't have to be decompiled in Android Studio)

查看:83
本文介绍了当用户添加gradle依赖项时如何使我的Android库源代码可见(因此不必在Android Studio中反编译代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jitpack.io上有一个Android库,让开发人员添加我的库,但只添加了依赖项.但是我注意到,如果添加了此依赖关系,则必须对我的库类进行反编译以查看代码.

I have an Android library on jitpack.io and let devs add my library but just adding the dependency. But what I've noticed is that if this dependency is added, my library classes have to be decompiled to view the code.

因此,例如,我的库中有一个名为ViewStack的类.当我尝试转到类文件查看源代码时,它是.class文件的反编译版本.因此,我的所有文档都不在那里.

So for example, I have a class in my library called ViewStack. When I try to go to the class file to view the source code, it's a decompiled version of the .class file. And thus, all my documentation is not there.

我如何做到这一点,使得代码完全可见(无需反编译),即使用户只是将库作为gradle依赖项添加,我的文档也可以通过?

How can I make it so the code is entirely viewable (no decompiling necessary) and my docs come through even if the user just is adding the library as a gradle dependency?

如果好奇的话,这是库: https://github.com/JayyyR/PancakesOnPlates

This is the library if curious: https://github.com/JayyyR/PancakesOnPlates

推荐答案

这取决于您将库发布为aar还是jar.

It depends if you're publishing the library as an aar or a jar.

对于aar文件,目前似乎无法实现

For aar files it doesn't seem to be possible at the moment How to publish Android .aar sources to make Android Studio automatically find them?

对于jar,您只需要在主jar上发布-sources.jar文件.

For jar you just need to publish the -sources.jar file along your main jar.

这篇关于当用户添加gradle依赖项时如何使我的Android库源代码可见(因此不必在Android Studio中反编译代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆