1

When writing a C implementation for a native Java method in Android, the rule is to name the C function according to the convention "Java_com_...". But I encountered an APK in which there are no such names in the so files and yet the program runs perfectly well. Are there other ways to map a Java native declaration to some function in the so files? Is there a technique to find the implementing function? I tried JDB, but it couldn't get into native codes. GDB requires the function name in the first place, which is missing in my case.

I forgot to mention that the Java code is obfuscated.

  • Wait ... all contained .so files don't have that? I have also been working on an app and the only time/place where the rule you cite applies would be in the JNI layer, right? So other libraries that are contained in the same application package may still have their own naming conventions. I'm not sure if there is such a thing as purely native apps in Android, but we have libraries that we otherwise also deploy on Linux and these are basically unchanged, but that one library that provides the bridge between the (Java) runtime and the lib abides by the rules. – 0xC0000022L Aug 6 '18 at 10:24
  • @0xC0000022L: I treated all so files as JNI-layer files and didn't consider other formats. My app is not a purely native app; that's why I mentioned a mapping from Java to C. My approach is quite primitive and I think that's one reason why I'm missing something. – Zirui Wang Aug 6 '18 at 10:56
  • does your file have JNI_OnLoad entry? – Igor Skochinsky Aug 6 '18 at 11:52
  • @IgorSkochinsky: Yes, it does. The next question is how to see its code. I can't see it in IDA Pro's function list. – Zirui Wang Aug 7 '18 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.