Vipul J
Vipul J

Reputation: 6691

How to convert a jar into native code and use it instead of jar in Android Project?

I am using a jar file which contains an algorithm I have developed. As it is easy to decompile it, in order to prevent it, I want to convert jar into native code and use it with NDK. How to do it ? Any other way to do it ?

Upvotes: 0

Views: 709

Answers (2)

Nithin CV
Nithin CV

Reputation: 7

Java code obfuscation is good to improve the security of your code from reverse engineering. Try any tools like progaurd

Upvotes: 0

Adam Stelmaszczyk
Adam Stelmaszczyk

Reputation: 19847

I'm assuming you've written your algorithm in Java. You must have it in C/C++ to use NDK.

I can see only 2 options:

  1. Write it from scratch in C/C++. Looking at your already written Java code it should be easy, but probably boring and time-consuming.
  2. Try some Java to C++ automatic converters, for example j2c. However, sometimes they're not working, they can change the code behavior, so you need to test it all thoroughly.

Upvotes: 1

Related Questions