Search code examples
androidsdkandroid-libraryhidden-files

Distribute an Android library hidding the source code


I have created a library in Android and I would like to distribute it as a SDK.

And I would like to show just one class as a public interface to the end-developers, hidding the rest of the classes of the SDK.

Any help or guide would be appreciated.


Solution

  • If you're creating an Android library with Java (meaning it's not a native library/shared object etc.), there is always a possibility that it's source can be decompiled. If you obfuscate it with a tool like Proguard, source code can still be decompiled but it would be obfuscated.

    The only way of hiding source of the library would be implementing it in native code (C/C++) and compile as a shared object (.so file / dynamic library) and provide a JNI wrapper in Java for public interface.