Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INSTALL_FAILED_DUPLICATE_PERMISSION with android.permission.QUERY_ALL_PACKAGES

I'm working in my app to read all installed applications to get the "icon" and package name in android 11 I must use android.permission.QUERY_ALL_PACKAGES I don't want to use <uses-permissions tag because that mean special requirements for Google Play, my app works with with the following xml tag in the Android Manifest

<permission android:name="android.permission.QUERY_ALL_PACKAGES" />

However apparently other apps are doing the same, and when they try to install my app or sideloading i receive the following message:

Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.package.myApp attempting to redeclare permission android.permission.QUERY_ALL_PACKAGES already owned by com.package.another_app]

Is any way to solve this issue? Thanks a lot!

like image 261
Javier Avatar asked Jun 09 '26 16:06

Javier


1 Answers

my app works with with the following xml tag in the Android Manifest

You should not getting any extra capabilities with that line. You should only be getting access to those apps based on your <queries> element, plus those that are visible to all apps regardless of package visibility rules.

However apparently other apps are doing the same, and when they try to install my app or sideloading i receive the following message:

The operating system defines that permission, as of Android 11. Apps cannot redefine that permission. Your app probably can be installed on many Android 10 and lower devices. On Android 11, since the OS is "installed" before your app, you will not be able to have that <permission> element, as you will get the error that you cite.

Is any way to solve this issue?

Remove the <permission> element. Either:

  • Request QUERY_ALL_PACKAGES,
  • Use the <queries> element to scope what access you need (see "Hole #1" in this blog post), or
  • Remove the app functionality that requires this level of access, at least on Android 11 and higher devices
like image 106
CommonsWare Avatar answered Jun 12 '26 13:06

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!