简体   繁体   English

修改Android设备上已安装的APK

[英]Modifying installed APKs on an android device

I'm experimenting with Android and I want to know if the following is possible: can I modify/patch an installed APP using another APP? 我正在尝试使用Android,我想知道以下是否可行:我可以使用其他APP修改/修补已安装的APP吗?

I know it's possible with root access, but I was wondering about non-rooted phones. 我知道root访问是可能的,但我想知道非root用户的手机。 The only solution that comes to mind is the following: 想到的唯一解决方案是:

-Create copy of original APK from data/app/ folder -Patch/rebuild it -Launch installation of the patched APK - 从数据/应用程序/文件夹创建原始APK的副本 - 修补/重建它 - 修补安装的修补APK

The user would need to confirm the installation, but in theory it would work right? 用户需要确认安装,但从理论上讲,它可以正常工作吗? Any other tecniques that I haven't thought of? 我还没有想到的任何其他技术?

In case you're wondering, I'm interested in injecting different strings and other resources into existing apps to provide translations or other modifications (ex: cheats in games), without changing the source of original apps. 如果您想知道,我有兴趣在现有应用中注入不同的字符串和其他资源,以提供翻译或其他修改(例如:游戏中的作弊),而无需更改原始应用的来源。

You are right, you can do this on a device. 你是对的,你可以在设备上做到这一点。 Smali/Baksmali can be used on Android, also the apktool should be callable (I have only tried smali). 可以在Android上使用Smali / Baksmali ,也可以调用apktool(我只试过smali)。

A year ago or so I have tried to use smali on a device and autopatch the source output. 一年前左右,我尝试在设备上使用smali并自动修补源输出。 There was some information on the net (which I'm currently unable to find, sorry) but it was very limited, at least someone showed how to use smali/baksmali correctly. 网上有一些信息(我目前无法找到,对不起),但它非常有限,至少有人展示了如何正确使用smali / baksmali。 I have abandoned this approach because I'm not that good at java and the resources on a phone are rather limited. 我放弃了这种方法,因为我不太擅长Java,并且电话上的资源非常有限。

Another approach I thought of was to offload the actual work to a server somewhere in the net. 我想到的另一种方法是将实际工作转移到网络中某个服务器上。 But this has its very own problem as you need to transfer the files, you may need the framework.apks, and so on. 但是这有其自身的问题,因为您需要传输文件,您可能需要framework.apks,等等。

This is interesting but hard stuff, you need to decode/parse/patch/rebuild apks and this has to be reliable. 这很有趣但很难,你需要解码/解析/补丁/重建apks,这必须是可靠的。 When you fail, the worst thing is that the users phone is broken (I wanted to modify critical system apks, bad idea ;)). 当你失败时,最糟糕的是用户手机坏了(我想修改关键系统apks,坏主意;))。

Better if the reinstall is seamless and for that you need: INSTALL_PACKAGES permission. 如果重新安装是无缝的,并且您需要这样做,则更好:INSTALL_PACKAGES权限。

Now, INSTALL_PACKAGES android:protectionLevel is "signatureOrSystem" which means the app needs to be signed with the same certificate that was used to sign the system image. 现在,INSTALL_PACKAGES android:protectionLevel是“ signatureOrSystem”,这意味着应用程序需要使用与用于签名系统映像相同的证书进行签名。

Now to sign one's app with the same certificate as the one used to sign the system image might seem like a difficult if not impossible task since vendors may not be to willing to let other's use their certificate. 现在,使用与用于签署系统映像的证书相同的证书来签署一个应用程序似乎是一项困难的(如果不是不可能的)任务,因为供应商可能不愿意让其他人使用他们的证书。 Then again, some might want your app included in their system image. 然后,有些人可能希望您的应用程序包含在他们的系统映像中。 In any case it doesn't matter per sey since it's Android and Android has a ROM market. 无论如何,这都不重要,因为它是Android且Android具有ROM市场。

Android ROMS are more and more synonymous with the general 'workings' or 'features' of Android. Android ROMS与Android的一般“功能”或“功能”越来越多。 It is something that Android users come to expect. 这是Android用户所期望的。 There are ROM manager apps available on the Android market that will list and install ROMs etc.. Android市场上有ROM管理器应用程序可以列出和安装ROM等。

So in essense for an app to gain the INSTALL_PACKAGES permission one can make their own ROM, OR, work with the people who make ROMS and either have the app included with the ROM or use the certificate used to sign the ROM's system image to sign the app. 因此,为了获得INSTALL_PACKAGES权限的应用程序,可以制作自己的ROM,或者与制作ROMS的人一起工作,或者将应用程序包含在ROM中,或者使用用于签署ROM的系统映像的证书来签署应用程序。

Again it is entirely possible that a vendor include the app in their "firmware" (system image). 同样,供应商完全有可能在其“固件”(系统映像)中包含该应用程序。 You would have to approach them. 您将不得不接近他们。

:) :)

if both are your app use . 如果两者都被您的应用程序使用。 content provider to share data between apps.and if other app is from another developer then you simply can't modify the app. 内容提供商在apps.and之间共享数据,如果其他应用程序来自其他开发人员,那么您根本无法修改应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM