为什么flutter有android.permission.REQUEST_INSTALL_PACKAGES

ven*_*eno 24 android android-permissions flutter

我将捆绑包上传到 google play 并显示包含 android.permission.REQUEST_INSTALL_PACKAGES的权限

这是我的 AndroidManifest 文件内容:

<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>
Run Code Online (Sandbox Code Playgroud)

此权限是什么?我如何处理它或将其从我的包中删除,当我在手机上安装我的应用程序时,此权限不显示?

小智 19

就像上面的答案一样,许多软件包可能都要求它。通过在 Androidmanifest.xml 中添加这些内容,可以将其从最终的 manifest.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

Run Code Online (Sandbox Code Playgroud)

tools:node='remove' 将从最终的manifest.xml中删除权限

此技术也可用于删除其他权限。

  • 我采用了这种方法,这次应用程序在 Play Store 上被接受了。 (2认同)

ven*_*eno 18

好的,我发现为什么 android.permission.REQUEST_INSTALL_PACKAGES 权限添加到包中,这是因为 file_open 包具有此权限,并且它自动添加到项目中

  • 我认为包名称是“open_file”(而不是“file_open”) (5认同)

Sli*_*ime 13

你可以检查一下build/app/outputs/logs/manifest-merger-release-report.txt文件。这是在您进行发布构建后生成的。

该文件包含有关如何AndroidManifest.xml创建最终版本以及权限可能来自何处的所有信息。

就我而言,它来自open_file包。


Aja*_*mar 5

我遇到了同样的问题。open_file就我而言,这是因为在浏览了有关同一主题的许多在线线程后出现的问题。我使用open_file_safe包来解决该问题。

open_file_safe 与 open_file 相同,但不支持 .apk 文件类型。因此,android.permission.REQUEST_INSTALL_PACKAGES 权限被删除。