简体   繁体   中英

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)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM