24

i upload my bundle to google play and show me this permissions which contain android.permission.REQUEST_INSTALL_PACKAGES

and this is my AndroidManifest file content:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flutter.application">

<!-- The INTERNET permission is required for development. Specifically,
     flutter needs it to communicate with the running application
     to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="flutter"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- This keeps the window background of the activity showing
             until Flutter renders its first frame. It can be removed if
             there is no splash screen (such as the default splash screen
             defined in @style/LaunchTheme). -->
        <meta-data
            android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
            android:value="true" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.yalantis.ucrop.UCropActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
</application>

what is this permission and how i can handle it or remove it from my package and when i install my app on phone this permission not show?

lenik
  • 23,228
  • 4
  • 34
  • 43
Amir
  • 2,225
  • 2
  • 18
  • 27

4 Answers4

18

ok i found why android.permission.REQUEST_INSTALL_PACKAGES permission added to package this is because file_open package has this permission and it added to project automatically

Amir
  • 2,225
  • 2
  • 18
  • 27
  • thanks, this solution solved my problem! – Mohammad Seyedmahmudi Mar 11 '22 at 11:17
  • Hi @Amir, How are you able to Identify that this package has that permission. I am having the same issue but I could not identify which package is bringing that permission to my apk. – Aravind Jul 25 '22 at 10:37
  • 1
    @aravind hi, set a mass search in your packages folder, you can do it with notepad++ (ctrl+f then find in file tab) and also in android studio packages folder address is in flutter directory -> packages – Amir Jul 25 '22 at 13:07
  • 1
    @Amir. Tanks. I found that the permission handler package in my project is the culprit. Will find an alternate package. – Aravind Jul 26 '22 at 15:39
  • 5
    I think the package name is `open_file` (not `file_open`) – Slick Slime Sep 16 '22 at 04:48
  • 1
    Use https://pub.dev/packages/open_file_safe instead of open_file. – p0enkie Dec 07 '22 at 07:13
18

As like the answers above it could have been requested by many packages. It can be made to be removed from the final manifest.xml by add these in the Androidmanifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" //Add this line
    package="com.example.app">

    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove"/>  //Add this line

The tools:node='remove' will remove the permission from final manifest.xml

This technique can be used to remove other permissions also.

13

You could check the build/app/outputs/logs/manifest-merger-release-report.txt file. This is generated after you make a release build.

This file contains all information on how the final AndroidManifest.xml is created and where permissions might come from.

In my case, it came from open_file package.

Slick Slime
  • 649
  • 7
  • 19
5

I came across the same issue. In my case, it was because of the pakage open_file after going through many online threads about the same topic. I used the open_file_safe package to resolve the issue.

open_file_safe is same as open_file, but .apk file type is not supported. Thus, android.permission.REQUEST_INSTALL_PACKAGES permission is removed.

Ajay Kumar
  • 15,250
  • 14
  • 54
  • 53
  • I had exactly the same issue. – Herry Feb 21 '23 at 22:09
  • Okay, after that change and also applying @Arun Jayaramakrishnan solution, still facing the same issue. The app is getting rejected again and again. Is there any alternate solution for that? – Yatinj Sutariya Mar 07 '23 at 05:34