1. 项目结构与配置
1.1 将 源码编译得到的 framework.jar 引入到 Android 项目中。
framework.jar 文件放入项目的 app/libs 目录下,并在 build.gradle 中配置相关的依赖。
修改 build.gradle(根目录)
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
Set<File> fileSet
if (options.bootstrapClasspath != null) {
fileSet = options.bootstrapClasspath.getFiles()
} else {
fileSet = new HashSet<>()
}
List<File> newFileList = new ArrayList<>();
newFileList.add(new File("./app/libs/framework.jar"))
newFileList.addAll(fileSet)
options.bootstrapClasspath = files(newFileList.toArray())
}
}
}
修改 app/build.gradle(应用模块)
dependencies {
compileOnly files('libs/framework.jar')
}
我们将 framework.jar 文件作为编译时的依赖引入项目。
1.2 设置系统签名
为了使应用具备系统应用的权限,你需要为应用签名,并使用系统级签名证书。首先,通过 keytool-importkeypair 工具生成一个签名文件。
在 build/target/product/security 目录下,执行以下命令:
keytool-importkeypair -k ./xxxxx.keystore -p pwd -pk8 platform.pk8 -cert platform.x509.pem -alias platform


225

被折叠的 条评论
为什么被折叠?



