简体   繁体   English

使用 React Native 构建的 Android 应用程序和 Expo 仍在请求应用程序权限

[英]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.

相关问题 React-Native应用程序卡住了要求权限 - React-Native app stuck asking for permissions Android React Native App 请求未在 android/app/src/main/AndroidManifest.xml 中定义的权限 - Android React Native App asking for permissions that are not defined within android/app/src/main/AndroidManifest.xml 如何从使用create-react-native-app构建的Android应用中删除短信和通话权限? - How to remove SMS and Call permissions from an Android app built with create-react-native-app? android应用权限未正确询问 - android app permissions is not asking properly 如何在使用 expo 构建的反应原生应用程序中的 AndroidManifest 中添加属性? - How to add properties in AndroidManifest in react native app built with expo? Expo React Native App 在 android 上崩溃 - Expo React Native App crashing on android 如何使用 expo 更新 React 本机 android 应用程序 - How to update React native android app with expo Expo React Native 应用程序在 Android 上崩溃,但在 Expo 上运行 Go - Expo React Native app crashes on Android but works in Expo Go React Native - 如何构建 expo 反应原生应用程序,使其不需要 Expo android 应用程序打开 - React Native - How to build expo react native app so that it does not require Expo android app to open React Native Android应用程序要求调用已弃用的&#39;FacebookSdk.sdkInitialize&#39; - React Native Android app asking to call deprecated 'FacebookSdk.sdkInitialize'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM