为什么从 AndroidManifest.xml 中删除权限不起作用? [英] Why does removing permission from AndroidManifest.xml not work?

查看:45
本文介绍了为什么从 AndroidManifest.xml 中删除权限不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个应用程序叫做 无需任何许可即可在 Play 商店中进行自重健身.它也可以在 git hub 上使用:https://github.com/mazurio/bodyweight-fitness-android

There is an app called bodyweight fitness on the play store without any permissions. It is available on git hub as well: https://github.com/mazurio/bodyweight-fitness-android

我使用了 git hub 中的文件,并使用 Android Studio 自己编译了 apk(不更改文件).当我尝试安装自编译的应用程序 apk 时,它告诉我它将使用互联网,尽管 Play 商店应用程序没有.这个应用程序没有理由需要任何互联网连接.因此我从 AndroidManifest.xml

I used the files from git hub and compiled the apk myself with Android Studio (without changing the files). When I try to install the self compiled app apk, it tells me that it will use the INTERNET though the play store app did not. There is no reason why this app should need any internet connection. Thus I removed this line from the AndroidManifest.xml

编译安装应用程序后,它仍然告诉我它将使用INTERNET.有人知道为什么以及如何删除此权限吗?

After compiling and installing the app, it still tells me that it will use INTERNET. Does someone know why and how I can remove this permission?

PS:我也问过开发者,但我还没有得到回应.

PS: I asked the developer as well, but I got no response yet.

更新:

  • 你是对的,它也是从另一个部分添加的:crashlytics.
  • 关于隐藏权限,您也是对的.它显示在应用程序安装时的应用程序详细信息,并在播放中显示单击权限"按钮时存储.

推荐答案

每个 android lib 都包含带有包、权限、活动等的清单文件,因此您的应用程序将显示依赖项的所有权限.您可以在 {projectDir}/{moduleDir}/build/outputs/logs/manifest-merger-*-report.txt

Each android lib contains manifest file with package, permissions, acitivities etc so your app will show all permissions from dependencies. You may check final manifest creation log at {projectDir}/{moduleDir}/build/outputs/logs/manifest-merger-*-report.txt

此日志将包含类似内容

uses-permission#android.permission.INTERNET
ADDED from {myModulePath}/app/src/main/AndroidManifest.xml:6:5-67
MERGED from [net.hockeyapp.android:HockeySDK:4.1.1] /Users/devindi/.android/build-cache/ce70c6f87efc05633a59a88fccdb712db509e22d/output/AndroidManifest.xml:12:5-67
MERGED from [com.crashlytics.sdk.android:crashlytics:2.6.8] /Users/devindi/.android/build-cache/424d420499b90aec0a26ab1b5f575e318d0342b9/output/AndroidManifest.xml:9:5-67
MERGED from [com.crashlytics.sdk.android:beta:1.2.5] /Users/devindi/.android/build-cache/be2498e53f6aa976b3927954da943b23f0a800f6/output/AndroidManifest.xml:9:5-67
MERGED from [com.crashlytics.sdk.android:crashlytics-core:2.3.17] /Users/devindi/.android/build-cache/e5b1b150113ac2f0789b76a886f379cdafa8af2b/output/AndroidManifest.xml:52:5-67
MERGED from [com.crashlytics.sdk.android:answers:1.3.13] /Users/devindi/.android/build-cache/c86f3a3daec296cb6a32deb0b3d0c3f1370a024f/output/AndroidManifest.xml:9:5-67
MERGED from [io.fabric.sdk.android:fabric:1.3.17] /Users/devindi/.android/build-cache/0a51b13dbc46dc870c598edab9d128bf8f26a8d4/output/AndroidManifest.xml:29:5-67

如您所见,我在清单和 hockeyapp、crashlytics、fabric 库中请求了网络权限,也请求了相同的权限.https://developer.android.com/studio/build/manifest-merge.html

As you see I requested network permission at my manifest and hockeyapp, crashlytics, fabric libs requested same permission also. https://developer.android.com/studio/build/manifest-merge.html

要强制删除权限,只需将 tools:node="remove" 添加到您的权限声明中,如下所示:

To force permission remove just add tools:node="remove" to your permission declaration like that:

<uses-permission android:name="android.permission.INTERNET" tools:node="remove" />

这篇关于为什么从 AndroidManifest.xml 中删除权限不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆