jessie
Introduction: 💃 run your android apps without installation - 让你的 APK 免安装运行
Tags:
Jessie 是一个插件化框架,可以让其他 APP 在免安装的情况下直接运行。
Jessie 可以像一个普通的 library 一样直接添加到宿主程序的依赖中。在宿主启动之后,Jessie 会自动运行。 其实,Jessie 在这背后在了很多事情,但这些事情对开发者来说是无感知的。
Jessie 支持以下特性:
- 支持加载第三方 APK
- 支持四大组件和 Fragment(动态和静态)
- 支持 Android Support 和 Jetpack
- 支持自定义 Theme
- 纯 Kotlin 实现
开始使用
设置依赖
配置根目录的 build.gradle。
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
在宿主程序的 build.gradle 中添加下面的依赖,插件程序无需配置。
implementation "com.github.7hens:jessie:<last_version>"
初始化
在宿主程序启动之后,Jessie 会自动运行并初始化,不需要额外的配置。
安装插件
val program = Jessie.install(apk)
卸载插件
Jessie.uninstall(programPackageName)
获取已安装的所有插件
Jessie.programs
获取插件信息
program.packageName
program.packageInfo
program.packageComponents
program.resources
program.classLoader
program.dexInfo
启动插件
宿主启动插件的 Launcher Activity
program.start()
宿主启动插件的特定 Activity
val intent = Intent().setComponent(programActivityComponent)
Jessie.startActivity(context, intent)
Jessie.startActivityForResult(context, intent, requestCode)