在不安装新 APK 的情况下更新应用程序

Updating App without installing new APK

我正在尝试查看是否可以在不下载 .apk 文件的情况下远程更新用户手机上的应用程序 。 (这是我的 "boss" 的信息收集请求。他认为在 iOS 上是可能的,所以他希望我在 Android 上查看)。

本质上,我试图让我的应用偶尔从我们的网络服务器中提取一个版本号,看看它是否需要更新,如果需要,那么该应用会请求许可,然后下载新文件(更新源代码, .xml 布局文件、图像等),从而完全无需从 Play 商店下载我们的 APK(大小为 50mb)来进行修补程序甚至是小的功能更新。

根据我的发现:

  1. 我可以下载 resource/data 个文本文件,可以阅读更多内容,但不能真正修改源代码,因为...

  2. APK 文件在创建时本质上是 "baked",因此源代码、.xml 文件等被最小化、重命名和混淆,这意味着添加新功能或修补程序到现有的 APK 会很困难。我认为您可以更改图像,仅此而已。

我相信 Candycrush 在他们下载新关卡时会以某种方式做到这一点(不涉及 Play 商店的应用内更新),但这可能只是方法 1。对 Firebase 的远程配置的简要研究也有类似的东西,但是预先设置参数的限制意味着尝试将它用于 hotfixing/updating 可能参差不齐。

我是正确的还是遗漏了一些明显的东西?

不更新apk是不可能更新源代码的。 Firebase Remote Config 可以帮助您在不更新应用程序的情况下更新某些参数的值。您也可以定义自己的方式从您自己的服务器下载额外的文件,但应用程序内部的源代码不能更改。

我认为使用patching系统可以解决您的问题。

一些图书馆可以帮助你:

  1. Tinker

    Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk.

  2. AndFix

    AndFix is a solution to fix the bugs online instead of redistributing Android App. It is distributed as Android Library.

    Andfix is an acronym for "Android hot-fix".

    AndFix supports Android version from 2.3 to 7.0, both ARM and X86 architecture, both Dalvik and ART runtime, both 32bit and 64bit.

    The compressed file format of AndFix's patch is .apatch. It is dispatched from your own server to client to fix your App's bugs

    Principle
    The implementation principle of AndFix is method body's replacing,

    ...

  3. Amigo

    Amigo is a hotfix library which can fix almost everything for your Android app.