0

Sometimes when you debug an Android library code, you can see the library's implementation, but there are other libraries where when you try to check the implementation of any function, you will see that the body of all the functions contains one line of code that throws an exception (Somehow hiding the real implementation). I want to do that in a commercial library, I tried R8 but the implementation is still accessible. Anyone can help or give me a hint ?

Note: I checked all the links suggested by Stackoverflow before posting this question.

Thanks in advance.

Ahmad Mahmoud Saleh
  • 169
  • 1
  • 4
  • 15
  • 1
    You don't. Those times you don't have the code- those are all parts of the framework, linked at runtime and when you look at the body it looks up the stubs provided by the framework. Even then when you run it in the debugger you'll see the implementation. It may be obfuscated, but you'll walk through it. – Gabe Sechan Apr 20 '22 at 19:57
  • But how do other libraries do it ? – Ahmad Mahmoud Saleh Apr 20 '22 at 20:52
  • 2
    Get your code added to the OS. Other than that, all you can do is obfuscate. – Gabe Sechan Apr 20 '22 at 21:08

1 Answers1

0

Apparently, there is no way to achieve that except by using very pricy libraries such as DexGuard, however, you can use abstraction to hide your code so only interfaces are exposed.

Ahmad Mahmoud Saleh
  • 169
  • 1
  • 4
  • 15