AndroidStudio配置JavaP反汇编

javaP:

java类文件反汇编程序

jni调用java对象时,需要使用到java类的方法、成员变量,都需要一些“java的签名”,

File->Settings->Tools->External Tools 扩展工具栏

新建一个


javaP.png

其中:program:

$JDKPath$/bin/javap

Agruments:

-classpath $OutputPath$ -p -s $FileClass$

Working directory:

$ProjectFileDir

点击保存。然后编译一下,保证我们的java代码已经生成了class文件,

右键对着JavaClass.java文件,

package com.by5388.demo.hellondk;

/**
 * @author by5388  on 2021/4/24.
 */
public class JavaClass {
    /**
     * 实例属性
     */
    private String mInstanceField = "instanceField";
    /**
     * 静态属性
     */
    private static String sStaticField = "staticField";

    public String getMyString() {
        return "myString";
    }

    public static String getStaticString(int a) {
        return String.valueOf(a);
    }
}

选择External -> JavaP,即可看到终端中有如下

Compiled from "JavaClass.java"
public class com.by5388.demo.hellondk.JavaClass {
  private java.lang.String mInstanceField;
    descriptor: Ljava/lang/String;
  private static java.lang.String sStaticField;
    descriptor: Ljava/lang/String;
  public com.by5388.demo.hellondk.JavaClass();
    descriptor: ()V

  public java.lang.String getMyString();
    descriptor: ()Ljava/lang/String;

  public static java.lang.String getStaticString(int);
    descriptor: (I)Ljava/lang/String;

  static {};
    descriptor: ()V
}

你可能感兴趣的:(AndroidStudio配置JavaP反汇编)