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)

淺唱寂寞╮ 提交于 2021-01-28 14:30:12

问题


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.

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.

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?

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


回答1:


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

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?

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



来源:https://stackoverflow.com/questions/37582432/how-to-make-my-android-library-source-code-visible-when-a-user-adds-the-gradle-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!