简体   繁体   English

是否可以从Java代码制作.so库?

[英]Is it possible to make .so library from java code?

I write programs on Java for Android. 我使用Java for Android编写程序。 I am trying to hide my java code from decompilation. 我正在尝试从反编译中隐藏我的Java代码。 Is it possible to make .so library from java code? 是否可以从Java代码制作.so库?

To "hide my java code from decompilation" you should use proguard . 要“从反编译中隐藏我的Java代码”,您应该使用proguard

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. ProGuard工具通过删除未使用的代码并使用语义上晦涩的名称重命名类,字段和方法来缩小,优化和混淆您的代码。 The result is a smaller sized .apk file that is more difficult to reverse engineer. 结果是一个较小的.apk文件,很难进行反向工程。

No obfuscation is perfect, but at least with proguard, the attacker can't get back to the same source code you started with. 没有任何混淆是完美的,但是至少使用proguard,攻击者无法恢复到最初使用的源代码。

And remember even with compiled c in a .so it can be reverse engineered, so it's not like that's a better solution. 请记住,即使编译的C的.so它可以逆向工程,所以它不是像这是一个更好的解决方案。

In response to your question: 针对您的问题:

Is it possible to make .so library from java code? 是否可以从Java代码制作.so库?

No you can't, you have to use JNI and write C code that implements the native functions you define in your Java code. 不,您不能,您必须使用JNI并编写实现您在Java代码中定义的本机函数的C代码。 This way, the .so library is compiled from C code. 这样, .so库是用C代码编译的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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