Securing a class file in Android Project

Kindly help me out with a method by which I can hide the code of a class file in Android Studio from other developers. The other developers can access the functions but they won’t be able to see the code inside of that class.

This idea comes from iOS, using a compiled static library. iOS uses a pre-compiled static library with which the developers can only access the functions and get the return values.

Reference Link for NDK static library: Use of prebuild static Library compiled with Android Toolchain

I don’t want to use Android NDK for doing this, I am sure Android SDK is capable of doing this on its own.

Using jar file can be a option, but jar can’t hide the code. The class files can easily be decompiled and the code will be exposed to everyone.


There is a long list of obfuscation tools for android, beginning with ProGuard which is part of the SDK.

Still, none of these achieves the level of protection you get by using a native library with NDK. But even the latter can not be completely protected from disassembling and reverse engineering. It can not be a substitute to legal protection, like patents and copyrights.

Leave a Reply

Your email address will not be published. Required fields are marked *