显示隐含权限的清单合并为什么?(Manifest merger showing implied permissions why?)

编程入门 行业动态 更新时间:2024-10-27 17:12:11
显示隐含权限的清单合并为什么?(Manifest merger showing implied permissions why?)

我最近升级到android studio 3.1,当我将我的项目作为签名版本构建时,谷歌播放控制台告诉我有3个新权限,我没有添加到我的清单。

然后,我检查了清单合并报告,并看到以下解释:

uses-permission#android.permission.WRITE_EXTERNAL_STORAGE IMPLIED from /Users/me/Development/QA/android/myapp/app/src/main/AndroidManifest.xml:2:1-222:12 reason: com.google.android.gms.license has a targetSdkVersion < 4 uses-permission#android.permission.READ_PHONE_STATE IMPLIED from /Users/me/Development/QA/android/myapp/app/src/main/AndroidManifest.xml:2:1-222:12 reason: com.google.android.gms.license has a targetSdkVersion < 4 uses-permission#android.permission.READ_EXTERNAL_STORAGE IMPLIED from /Users/me/Development/QA/android/myapp/app/src/main/AndroidManifest.xml:2:1-222:12 reason: com.google.android.gms.license requested WRITE_EXTERNAL_STORAGE

这是什么意思,为什么说牌照类的targetSdkVersion小于4?

这是我的gradle依赖版本:

firebase_version = '12.0.1' supportlib_version = '27.0.2' room_version = '1.0.0' espresso_version = '3.0.1' archLifecycleVersion = '1.1.1'

这是我的最小sdks:

android { compileSdkVersion 27 defaultConfig { minSdkVersion 16 targetSdkVersion 27 applicationId "com.mobile.myapp" multiDexEnabled true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

我确实检查了google api的发行说明 ,并看到firebase已更新为12.0.1,但我已经在使用它了。 我的目标是,如果Google不需要这些权限,我就不需要这些权限。 如果它只是用于许可证文件,我不想包含这些权限? 有任何想法吗 ? 我也不知道隐含的许可是什么。 但是让我告诉你我的清单中的实际权限:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.mobile.myapp"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <!-- firebase analytics needs to hold a wake lock --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- hotline io uses record audio dangerous permission, we will remove it here --> <uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" /> //...

更新 :这是我的谷歌播放服务版本:

<integer name="google_play_services_version">12211000</integer>

我有两个谷歌播放服务组件我在这里使用它们是:

// Analytics implementation "com.google.android.gms:play-services-analytics:$firebase_version" implementation("com.google.android.gms:play-services-auth:$firebase_version") { force = true }

firebase_version = '12 .0.1'是最新的。

这里是顶级依赖项:

dependencies { classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.google.gms:google-services:3.2.0' classpath 'io.fabric.tools:gradle:1.25.1' classpath "com.newrelic.agent.android:agent-gradle-plugin:5.+" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }

I recently upgraded to android studio 3.1 and when i build out my project as a signed release the google play console tells me that there are 3 new permissions which i did not add to my manifest.

I then checked the manifest merger report and saw the following explaination:

uses-permission#android.permission.WRITE_EXTERNAL_STORAGE IMPLIED from /Users/me/Development/QA/android/myapp/app/src/main/AndroidManifest.xml:2:1-222:12 reason: com.google.android.gms.license has a targetSdkVersion < 4 uses-permission#android.permission.READ_PHONE_STATE IMPLIED from /Users/me/Development/QA/android/myapp/app/src/main/AndroidManifest.xml:2:1-222:12 reason: com.google.android.gms.license has a targetSdkVersion < 4 uses-permission#android.permission.READ_EXTERNAL_STORAGE IMPLIED from /Users/me/Development/QA/android/myapp/app/src/main/AndroidManifest.xml:2:1-222:12 reason: com.google.android.gms.license requested WRITE_EXTERNAL_STORAGE

What does this mean , why is it saying the license class has a targetSdkVersion less then 4 ?

here are my gradle dependency versions:

firebase_version = '12.0.1' supportlib_version = '27.0.2' room_version = '1.0.0' espresso_version = '3.0.1' archLifecycleVersion = '1.1.1'

and here are my minimum sdks:

android { compileSdkVersion 27 defaultConfig { minSdkVersion 16 targetSdkVersion 27 applicationId "com.mobile.myapp" multiDexEnabled true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

i did check the release notes for google api and saw that firebase was updated to 12.0.1 but im already using that. My goal is i do not want these permissions if they are not needed by google. i dont want to include these permission if its just for a license file ? any ideas ? i also do not know what an implied permission is. but let me show you my actual permissions in my manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.mobile.myapp"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <!-- firebase analytics needs to hold a wake lock --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- hotline io uses record audio dangerous permission, we will remove it here --> <uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" /> //...

UPDATE: here is my google play services version:

<integer name="google_play_services_version">12211000</integer>

and i have two google play services components i use here they are:

// Analytics implementation "com.google.android.gms:play-services-analytics:$firebase_version" implementation("com.google.android.gms:play-services-auth:$firebase_version") { force = true }

WHERE firebase_version = '12.0.1' IS THE LATEST.

and here are the top level dependencies:

dependencies { classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.google.gms:google-services:3.2.0' classpath 'io.fabric.tools:gradle:1.25.1' classpath "com.newrelic.agent.android:agent-gradle-plugin:5.+" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }

最满意答案

以下步骤纠正了该问题:

将gradle包装器更新到最新的4.6

然后创建以下依赖项解析策略,强制所有库遵守Google Play库的最新版本(此时):

subprojects { //todo change this to loop once project.configurations.all { resolutionStrategy.eachDependency { details -> if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex')) { details.useVersion "$supportlib_version" } else if(details.requested.group == 'com.google.android.gms'){ details.useVersion(firebase_version) //this is critical to resolve the error } } resolutionStrategy { forcedModules = [ "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version", "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" ] } } }

The following steps rectified the issue:

update gradle wrapper to latest 4.6

then create the following dependency resolution strategy that forces all libraries to comply with latest version (at this time) of google play libraries:

subprojects { //todo change this to loop once project.configurations.all { resolutionStrategy.eachDependency { details -> if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex')) { details.useVersion "$supportlib_version" } else if(details.requested.group == 'com.google.android.gms'){ details.useVersion(firebase_version) //this is critical to resolve the error } } resolutionStrategy { forcedModules = [ "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version", "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" ] } } }

更多推荐

android,google,permission,com,电脑培训,计算机培训,IT培训"/> <meta name="

本文发布于:2023-07-30 07:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336690.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:清单   权限   Manifest   merger   implied

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!