[英]Android app built with React Native and Expo still asking for app permissions
I built an Android app using React Native and building the apk file using expo expo build:android
.我使用 React Native 构建了一个 Android 应用程序并使用 expo
expo build:android
apk 文件。 However, when I run the app on an emulator, even after removing all permissions from AndroidManifest.xml, the app still asks for Physical Activity permissions:但是,当我在模拟器上运行该应用程序时,即使从 AndroidManifest.xml 中删除了所有权限,该应用程序仍会要求提供体育锻炼权限:
android/app/src/main/AndroidManifest.xml android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<package.name>">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->
<!-- These require runtime permissions on M -->
<!-- END OPTIONAL PERMISSIONS -->
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="YOUR-APP-URL-HERE" />
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="YOUR-APP-SDK-VERSION-HERE" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Permissions Screenshot权限截图
I have tried adding the tools:node="remove"
tag rather than removing the uses-permissions lines but this had no effect.我尝试添加
tools:node="remove"
标签而不是删除 uses-permissions 行,但这没有效果。
My app requires no permissions and this issue is preventing me from uploading to the Play Store.我的应用不需要任何权限,这个问题阻止我上传到 Play 商店。 I read in other posts that a library I am using might be requesting permissions but I do not believe any of the npm libraries I am using would require any such permissions:
我在其他帖子中读到我正在使用的库可能正在请求权限,但我不相信我正在使用的任何 npm 库都需要任何此类权限:
package.json package.json
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"av": "^0.4.9",
"expo": "~37.0.3",
"expo-av": "^8.1.0",
"expo-updates": "~0.1.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "~0.61.5",
"react-native-elements": "^2.0.0",
"react-native-gesture-handler": "~1.6.0",
"react-native-modal": "^11.5.6",
"react-native-popup-dialog": "^0.18.3",
"react-native-reanimated": "~1.7.0",
"react-native-responsive-fontsize": "^0.4.3",
"react-native-responsive-screen": "^1.4.1",
"react-native-screens": "~2.2.0",
"react-native-unimodules": "~0.9.0",
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"react-test-renderer": "~16.9.0"
},
"jest": {
"preset": "react-native"
},
"private": true
}
Any help would be appreciated.任何帮助,将不胜感激。
So after some further digging, https://docs.expo.io/workflow/configuration/?redirected , what fixed this issue was adding android.permissions = []
to my app.json: So after some further digging, https://docs.expo.io/workflow/configuration/?redirected , what fixed this issue was adding
android.permissions = []
to my app.json:
"android": {
"package": "<package name>",
"versionCode": 1,
"permissions": []}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.