有些系统接口标志为@system api,接口的参数又带有abstract类型,无法反射调用。用以下方法可以调用到特定版本的api:
下载对应版本的framework.jar包
build.gradle:
dependencies {
compileOnly files('libs/framework.jar')
}
gradle.projectsEvaluated { tasks.withType(JavaCompile) { Set<File> fileSet = options.bootstrapClasspath.getFiles() List<File> newFileList = new ArrayList<>(); newFileList.add(new File("libs/framework.jar")) newFileList.addAll(fileSet) options.bootstrapClasspath = files( newFileList.toArray() ) } }