有时候在java层能获取dex文件的cookie,但是在java不能从cookie得到dex,如果想要获取只能通过jni在C层实现,具体实现代码如下(nexus手机4.4系统)

static void dumpDex(JNIEnv *env, jobject object, jint gcookie) {
    int cookie = gcookie;

    DexOrJar *a = (struct DexOrJar *) cookie;

    int len = a->pDexMemory[34] << 16 | a->pDexMemory[33] << 8 | a->pDexMemory[32];

    int fd = open("/data/local/tmp/1.dex", O_RDWR | O_CREAT);
    write(fd, a->pDexMemory, len);
    close(fd);
}

相关文章:

  • 2021-06-18
  • 2021-08-28
  • 2021-06-24
  • 2021-08-01
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-05
  • 2021-09-02
  • 2022-01-21
  • 2021-11-13
  • 2021-07-23
  • 2022-12-23
  • 2021-06-25
相关资源
相似解决方案