Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APKMirror Installer: .apkm fails to install on devices running MIUI #116

Open
panhoong opened this issue Mar 25, 2020 · 72 comments
Open

APKMirror Installer: .apkm fails to install on devices running MIUI #116

panhoong opened this issue Mar 25, 2020 · 72 comments
Assignees
Labels

Comments

@panhoong
Copy link

Actual behavior

When I try to install the Netflix .apkm file using the APKMirror Installer, it gives me an error message: "App installation failed. The system failed to install the package because of system issues."

On Xiaomi Mi 8 running on Android 10 (MIUI 11.0.6 China Stable release, QEACNXM)

@the4anoni
Copy link

Try disabling miui optimizations, install app, and re-enable miui optimizations.

Xiaomi.eu team fixed this issue in their weekly roms, but for SAI, not APKmirror installer.

@archon810
Copy link
Collaborator

@panhoong Can you please confirm whether this works?

@the4anoni Do you have the relevant thread url where the fix was mentioned? I'm curious what the problem may be.

It's probably not going to get fixed on older devices. I wonder if we can detect whether MIUI optimizations are on programmatically and pop something up to disable them.

@the4anoni
Copy link

@panhoong Can you please confirm whether this works?

@the4anoni Do you have the relevant thread url where the fix was mentioned? I'm curious what the problem may be.

It's probably not going to get fixed on older devices. I wonder if we can detect whether MIUI optimizations are on programmatically and pop something up to disable them.

Aefyr/SAI@0f9fe36

Kacskrz is from xiaomi.eu team

@archon810
Copy link
Collaborator

Thank you.

Xiaomi.eu team fixed this issue in their weekly roms, but for SAI, not APKmirror installer.

I don't know anything about the fix itself, but I doubt it's specific to SAI. SAI just shows a warning to MIUI users, and I'm afraid we have no choice but to do the same.

However, the good news is we managed to get in touch with a Xiaomi engineer and have given him the details of the issue, so maybe something will happen as a result.

@archon810 archon810 changed the title APKMirror Installer: .apkm fails to install APKMirror Installer: .apkm fails to install on devices running MIUI Mar 27, 2020
@archon810
Copy link
Collaborator

I've left a note for MIUI users in the app description, and we're probably going to show a warning in the event of an installation failure. Our developer ordered a Poco device, so we'll be able to test the fix soon.

@asesinopr
Copy link

Hi! Im having issues trying to checkmark Architecture part. Is there anything I can do? Im using an androidbox t95.

@archon810
Copy link
Collaborator

@asesinopr Please open a separate issue and explain it in more detail. It doesn't seem related to this MIUI issue.

@IgorEisberg
Copy link

IgorEisberg commented May 18, 2020

Try disabling miui optimizations, install app, and re-enable miui optimizations.

Xiaomi.eu team fixed this issue in their weekly roms, but for SAI, not APKmirror installer.

I'm Igor from Xiaomi.eu team. APKMirror Installer works fine here. Tested by installing Netflix APKM bundle. No issues at all. The reason being that we disable the restriction that only allows select few package names to initiate installer sessions on our ROMs. (it can also be disabled by disabling MIUI optimization, which we remove from our ROMs as it's not relevant since we disable nonsense like that ourselves by default).
You can always check if MIUI optimizations are on by checking the "persist.sys.miui_optimization" system property (values are either 1 or 0). You can also use reflection on the "isXOptMode" method (no arguments, returns a primitive boolean) in class "android.miui.AppOpsUtils", but the result's meaning is reversed (true means that the user has opted out of MIUI optimization).
However, it is very unlikely that APKMirror team can do anything about that restriction, it's part of MIUI's framework security policy.

@archon810
Copy link
Collaborator

@IgorEisberg Are you confirming that your ROMs have added com.apkmirror.helper.prod to the whitelist?

@IgorEisberg
Copy link

@IgorEisberg Are you confirming that your ROMs have added com.apkmirror.helper.prod to the whitelist?

No, I confirmed that we have no blacklist/whitelist, I completely disabled the restriction, any installer should work fine, like on AOSP ROMs.

@archon810
Copy link
Collaborator

Thank you. Now if only Xiaomi would remove this ridiculous limitation from their core ROMs, but so far our attempts to convince their engineer have failed.

@IgorEisberg
Copy link

As far as I understand, from security stand-point, the purpose is to prevent malicious installers from silently pushing malicious apps... but there's already a security measure for that: the "Install unknown apps" special permission which has to be explicitly granted by the user. So... I really don't see the actual purpose of this restriction.

@AndroidDeveloperLB
Copy link

It can't be done silently if it already asks the user to confirm the installation anyway via the OS dialog, so this behavior is useless and not needed.

Are you guys saying that starting from some Android/MIUI version this behavior is gone? If so, from which?

@the4anoni
Copy link

It can't be done silently if it already asks the user to confirm the installation anyway via the OS dialog, so this behavior is useless and not needed.

Are you guys saying that starting from some Android/MIUI version this behavior is gone? If so, from which?

Only from Xiaomi.eu 20.2.20 and never. Stock Miui still has this problem.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 23, 2020

@the4anoni Stock? Xiaomi has various types of MIUI ? One for Europe and one for something else (China?) ?

Why the need for it? Why can't they use the standard that developers can handle? Once an app tries to install another app, the OS already asks the user if it's ok to install.

Xiaomi is one of the most terrible ones on the https://dontkillmyapp.com/ website, with made up rules that are turned on by default, breaking apps. Users usually don't even notice because of white-lists of popular apps, and when they do, they blame the developers because it works fine on the popular apps. And developers have nothing to do about it...

Xiaomi should stop with these made up rules, at least by default. Let only users who enable them (manually, when they reach the settings) deal with the breaking of apps. It's unfair that Xiaomi lets some apps work fine and some not, by default.

@the4anoni
Copy link

@the4anoni Stock? Xiaomi has various types of MIUI ? One for Europe and one for something else (China?) ?

Why the need for it? Why can't they use the standard that developers can handle? Once an app tries to install another app, the OS already asks the user if it's ok to install.

Xiaomi is one of the most terrible ones on the https://dontkillmyapp.com/ website, with made up rules that are turned on by default, breaking apps. Users usually don't even notice because of white-lists of popular apps, and when they do, they blame the developers because it works fine on the popular apps. And developers have nothing to do about it...

Xiaomi should stop with these made up rules, at least by default. Let only users who enable them (manually, when they reach the settings) deal with the breaking of apps. It's unfair that Xiaomi lets some apps work fine and some not, by default.

Xiaomi has many stock ROMs:

  1. China:
    Stable
    Weekly
  2. Global Stable
  3. EEA Stable
  4. Russia Stable
  5. India Stable

Xiaomi.eu is Custom rom based on China, both Stable or weekly.

@AndroidDeveloperLB
Copy link

@the4anoni Why is it called "Xiaomi.eu" ? I thought it means "Europe" .

Which of those stock ROMs has the problematic behavior and which don't? How in code do you check that it has it?

This was mentioned above:

You can always check if MIUI optimizations are on by checking the "persist.sys.miui_optimization" system property (values are either 1 or 0). You can also use reflection on the "isXOptMode" method (no arguments, returns a primitive boolean) in class "android.miui.AppOpsUtils", but the result's meaning is reversed (true means that the user has opted out of MIUI optimization).

Is it official? Can it be used without worrying ? How can I find more of such special flags (example the "auto-start" permission of Xiaomi) ? And is there an Intent that developers can use to reach the exact setting for users to reach and enable/disable them there?

@the4anoni
Copy link

the4anoni commented May 23, 2020

@the4anoni Why is it called "Xiaomi.eu" ? I thought it means "Europe" .

Because this project started long time before Xiaomi made Miui for other regions than China.

All stock ROMs don't work with SAI or apkmirror installer.

@AndroidDeveloperLB
Copy link

@the4anoni Didn't you guys say that the restriction was removed from MIUI at some point and it should work fine ? Maybe it's from some MIUI version, or something?

Quotes:

"APKMirror Installer works fine here. Tested by installing Netflix APKM bundle. No issues at all"
"I completely disabled the restriction, any installer should work fine, like on AOSP ROMs."

On SAI, it claims it should not be needed from MIUI 20.2.20 , and I've found only one forum thread that only has a clue about this, but nothing official: https://xiaomi.eu/community/threads/need-to-turn-off-miui-optimization-for-mi-9.54624/

Is it possible that on some stock ROMs of Xiaomi, starting from this version, the restriction is disabled by default (or doesn't even exist) ?

@the4anoni
Copy link

@the4anoni Didn't you guys say that the restriction was removed from MIUI at some point and it should work fine ? Maybe it's from some MIUI version, or something?

Quotes:

"APKMirror Installer works fine here. Tested by installing Netflix APKM bundle. No issues at all"
"I completely disabled the restriction, any installer should work fine, like on AOSP ROMs."

On SAI, it claims it should not be needed from MIUI 20.2.20 , and I've found only one forum thread that only has a clue about this, but nothing official: https://xiaomi.eu/community/threads/need-to-turn-off-miui-optimization-for-mi-9.54624/

Is it possible that on some stock ROMs of Xiaomi, starting from this version, the restriction is disabled by default (or doesn't even exist) ?

Xiaomi.eu is still a Miui

@AndroidDeveloperLB
Copy link

@the4anoni You didn't answer the question...

@the4anoni
Copy link

@the4anoni You didn't answer the question...

I did, read all discussion again. Nobody said this was fixed in stock Xiaomi ROMs.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 23, 2020

@the4anoni I gave you quotes about it, showing that the dev of Xiaomi said it worked fine for him, and that he disabled the restriction.

Also, SAI says as such (search for "installer_miui_warning_message") :

https://github.com/Aefyr/SAI/blob/bd4d4eb37016711b6250caa276359f4bdad3d2fb/app/src/main/res/values/strings.xml

This issue is supposed to be fixed on MIUI 20.2.20 and up (xiaomi.eu and eu-based ROMs).

@AndroidDeveloperLB
Copy link

Anyway, attached here a sample POC to check on Xiaomi's restriction. Hope this could help anyone here.

My Application.zip

@IgorEisberg
Copy link

@IgorEisberg The OS will crash on some cases just because you disabled it? What is the scenario exactly, to cause a crash just because you've done it?
Does it include even user behavior that doesn't use anything of the special things of MIUI (meaning only vanilla features) ?

Look, I'm not exactly into testing what happens when MIUI optimizations are off, this isn't one of our usage scenarios. One example to what happens when disabling it (might have been changed already, don't know) is that Always-on display setting is being displayed on devices with LCD screens. Those devices don't have the MiuiAod.apk that is responsible for AOD, so clicking that setting will cause Settings app to crash because the activity can't be found.

@AndroidDeveloperLB
Copy link

@IgorEisberg I now tested on Xiaomi Redmi 8, and disabling MIUI optimizations didn't cause a crash when enabling/disabling always-on-display. However, I don't think it does anything, with or without MIUI optimizations turned on. I don't get why it even exists... I tried to restart the OS even (when both of these are turned on), but this feature doesn't do anything, and it got even weirder: the feature of always-on-display was gone.

Seems that disabling MIUI optimizations lets you see always-on-display setting, even though it doesn't do anything at all.

@IgorEisberg
Copy link

@IgorEisberg I now tested on Xiaomi Redmi 8, and disabling MIUI optimizations didn't cause a crash when enabling/disabling always-on-display. However, I don't think it does anything, with or without MIUI optimizations turned on. I don't get why it even exists... I tried to restart the OS even (when both of these are turned on), but this feature doesn't do anything, and it got even weirder: the feature of always-on-display was gone.

Seems that disabling MIUI optimizations lets you see always-on-display setting, even though it doesn't do anything at all.

Of course it doesn't. The actual AOD content is in MiuiAod.apk which isn't included with devices with LCD screens. It used to crash when AOD was accessible from a preference with an Intent attached to it. No longer an issue, but still reveals settings that aren't supposed to be shown.
As to "why it even exists", that's a weird question. MIUI shares code across different devices, with certain checks to hide/show different stuff depending on the device's supported features. It would be absurdly difficult to maintain separate code bases for each and every device. That would be literally unmaintainable.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 29, 2020

@IgorEisberg It should be very easy to avoid this case. Add a condition: If it's LCD screen, don't show the setting, ever.
Or, if what's in charge of a setting doesn't exist, don't show it.

@IgorEisberg
Copy link

@IgorEisberg It should be very easy to avoid this case. Add a condition: If it's LCD screen, don't show the setting, ever.
Or, if what's in charge of a setting doesn't exist, don't show it.

I never argued that it's hard to hide... I just said that I have no reason to. We have no MIUI optimization-related issues that I know of.

@AndroidDeveloperLB
Copy link

@IgorEisberg You already explained there is a reason: It can crash or not do anything at all.

@IgorEisberg
Copy link

@IgorEisberg You already explained there is a reason: It can crash or not do anything at all.

It can crash if MIUI optimization is disabled, not the other way around... hence I see no reason to touch it.

@AndroidDeveloperLB
Copy link

@IgorEisberg Right, and since users can disable it (and they might, because it's a custom ROM so it's power users and developers audience), it is an issue.

@IgorEisberg
Copy link

@IgorEisberg Right, and since users can disable it (and they might, because it's a custom ROM so it's power users and developers audience), it is an issue.

Not my issue. I'm not a babysitter.

@AndroidDeveloperLB
Copy link

@IgorEisberg Crashing or doing nothing for a setting is a bug. Doesn't matter how user reached it.

Anyway, your choice. I have Pixel 4 :)

@IgorEisberg
Copy link

Crashing or doing nothing for a setting is a bug. Doesn't matter how user reached it.

Of course it does matter. If it's not normally accessible to the end-user and the user unlocked developer mode (which is common practice in MIUI apps) or used Activity Launcher of some sort, and the activity crashed or the user reached some page that's not being used by the OS normally, then it's the user's problem.

@AndroidDeveloperLB
Copy link

@IgorEisberg OK. I don't agree.

@IgorEisberg
Copy link

@IgorEisberg OK. I don't agree.

Doesn't matter if you agree or not. That's the reality of how Android is built, especially non-stock Android.

@AndroidDeveloperLB
Copy link

@IgorEisberg Xiaomi ruined Android in various ways. This is just one of those cases.

@mafutha
Copy link

mafutha commented Jun 25, 2020

On problem with disabling optimizations is it also cancels all permissions of all apps. Thus results in, after enabling optimizations one has to give permissions to every freakin app.

@JohnRTitor
Copy link

I am noting that even though Xiaomi restricts installation of apks using third party installers, adb install-multiple still can install app bundles. An app can utilise the similar code but it would need android.permission.INSTALL_PACKAGES permission, which is only granted to system apps. However, there is an alternative which SAI (Split Apk Installer) uses, Shizuku mode which allows SAI to run ADB commands from the mobile device, provided Shizuku is running and SAI has the permission to use it. https://play.google.com/store/apps/details?id=moe.shizuku.privileged.api I wonder if @archon810 is interested to implement it in APK mirror installer. I use Shizuku mode on SAI on my MIUI device with MIUI optimization enabled. And it works, because it's technically a shell based installer.

@tri-cloud
Copy link

Actual behavior

When I try to install the Netflix .apkm file using the APKMirror Installer, it gives me an error message: "App installation failed. The system failed to install the package because of system issues."

On Xiaomi Mi 8 running on Android 10 (MIUI 11.0.6 China Stable release, QEACNXM)

I need advice on getting Apk mirror on , LG. Stylo 6 metro pcs phone

@xkeyC
Copy link

xkeyC commented Nov 30, 2021

The latest stable version of MIUI China is now working fine.

@JohnRTitor
Copy link

Looks like it also got fixed in the latest stable MIUI 12 global ROM update.. Hopefully it is not a temporary glitch/bug and they actually addressed it this time.
IMG_20211203_090737

@archon810
Copy link
Collaborator

Well this is great news, thanks for letting us know.

@xkeyC
Copy link

xkeyC commented Jan 23, 2022

The latest stable version of MIUI China is now working fine.

Not work on MIUI13 China Edition

@kingdj
Copy link

kingdj commented Apr 15, 2022

Hey, While installing the apk on Asus - Android 9, the installer says
"apk installation failed, unable to list the files inside .apkm bundle"

Pls help.

inCollage_20220415_111437469.jpg

@archon810
Copy link
Collaborator

Hey, While installing the apk on Asus - Android 9, the installer says "apk installation failed, unable to list the files inside .apkm bundle"

Pls help.

Does this happen to apk apkms or only a specific one? I haven't seen this error before (or at least in a long time), and you're the only person who reported it.

@kingdj
Copy link

kingdj commented Apr 19, 2022

Actually I tried to install 'Sonic Forces' moded apk file downloaded from some external sources, where while installing the same I got this error.

@illogical-robot illogical-robot deleted a comment from azc12345 Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

13 participants