Expo SDK 50 更新添加了 android.permission.FOREGROUND_SERVICE_LOCATION

问题描述 投票:0回答:1

我有一个 Expo 管理的 React Native 应用程序。最近我将Expo SDK版本从48更新到50。

现在,当我尝试在 Play 商店上传新的 Android 版本时,我收到以下消息。以前从来没有过。

这是我的package.json文件内容:

  "name": "myabcapp",
  "version": "1.23.4",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@openspacelabs/react-native-zoomable-view": "^2.0.4",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-native-community/netinfo": "9.3.7",
    "@react-native-community/slider": "4.4.2",
    "@react-native-firebase/app": "^17.4.1",
    "@react-native-firebase/auth": "^17.4.1",
    "@react-native-google-signin/google-signin": "^9.0.2",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.0",
    "@react-navigation/stack": "^6.3.2",
    "@stripe/stripe-react-native": "0.23.3",
    "apisauce": "^2.1.6",
    "expo": "^48.0.0",
    "expo-apple-authentication": "~6.0.1",
    "expo-build-properties": "~0.6.0",
    "expo-constants": "~14.2.1",
    "expo-dev-client": "~2.2.1",
    "expo-document-picker": "~11.2.2",
    "expo-font": "~11.1.1",
    "expo-image-picker": "~14.1.1",
    "expo-linear-gradient": "~12.1.2",
    "expo-linking": "~4.0.1",
    "expo-localization": "~14.1.1",
    "expo-location": "~15.1.1",
    "expo-notifications": "~0.18.1",
    "expo-splash-screen": "~0.18.2",
    "expo-status-bar": "~1.4.2",
    "expo-tracking-transparency": "~3.0.3",
    "formik": "^2.2.9",
    "html-entities": "^2.3.3",
    "lodash": "^4.17.21",
    "lottie-react-native": "5.1.4",
    "mime": "^3.0.0",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.41",
    "qs": "^6.11.0",
    "react": "18.2.0",
    "react-native": "0.71.14",
    "react-native-draggable-flatlist": "^3.1.2",
    "react-native-fbsdk-next": "^11.2.0",
    "react-native-geocoding": "^0.5.0",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-google-mobile-ads": "^10.0.1",
    "react-native-maps": "1.3.2",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-progress": "^5.0.0",
    "react-native-razorpay": "^2.3.0",
    "react-native-read-more-text": "^1.1.2",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-svg": "13.4.0",
    "react-native-webview": "11.26.0",
    "react-native-youtube-iframe": "^2.2.2",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3"
  },
  "private": true

这是我的app.json文件内容:

{
  "expo": {
    "name": "My abc App",
    "slug": "myabcapp",
    "version": "1.23.4",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          },
          "android": {
            "compileSdkVersion": 33,
            "targetSdkVersion": 33,
            "buildToolsVersion": "30.0.2",
            "kotlinVersion": "1.7.10"
          }
        }
      ],
      "@react-native-firebase/app",
      "./react-native-maps-plugin",
      [
        "@stripe/stripe-react-native",
        {
          "merchantIdentifier": "",
          "enableGooglePay": false
        }
      ],
      [
        "expo-document-picker",
        {
          "appleTeamId": "M34O29V5ZF",
          "iCloudContainerEnvironment": "Production"
        }
      ],
      [
        "expo-notifications",
        {
          "icon": "./assets/icon96x96.png",
          "color": "#ffffff",
          "mode": "production"
        }
      ],
      [
        "expo-tracking-transparency",
        {
          "userTrackingPermission": "My Abc App wants to track you to collect IDFA to deliver personalised ads."
        }
      ],
      "@react-native-google-signin/google-signin",
      [
        "react-native-fbsdk-next",
        {
          "appID": "471576785566340",
          "clientToken": "7c51e110a70788y5418478cebdcbcf7d",
          "displayName": "My Abc App",
          "advertiserIDCollectionEnabled": false,
          "autoLogAppEventsEnabled": false,
          "isAutoInitEnabled": true
        }
      ],
      "expo-localization"
    ],
    "splash": {
      "image": "./assets/splash.png",
      "backgroundColor": "#f85c70",
      "resizeMode": "cover"
    },
    "notification": {
      "icon": "./assets/icon96x96.png",
      "color": "#ffffff",
      "iosDisplayInForeground": true,
      "androidMode": "default"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "bitcode": "Debug",
      "usesAppleSignIn": true,
      "supportsTablet": true,
      "bundleIdentifier": "com.myabcapp",
      "buildNumber": "30",
      "usesIcloudStorage": true,
      "infoPlist": {
        "NSUserTrackingUsageDescription": "My Abc App wants to track you to collect IDFA to deliver personalised ads.",
        "NSCameraUsageDescription": "My Abc App uses the camera to capture and upload user profile image and Listing Image to the server.",
        "NSPhotoLibraryUsageDescription": "My Abc App needs access to the photo library to select and upload user profile image and Listing Image to the server.",
        "NSPhotoLibraryAddUsageDescription": "My Abc App needs access to the photo library to select and upload user profile image and Listing Image to the server.",
        "NSLocationWhenInUseUsageDescription": "My Abc App usages device location on listing information, Listing search Data and User information.",
        "NSLocationAlwaysAndWhenInUseUsageDescription": "My Abc App usages device location on listing information, Listing search Data and User information.",
        "NSLocationAlwaysUsageDescription": "My Abc App uses device location on listing information, Listing search Data and User information.",
        "NSMicrophoneUsageDescription": "My Abc App uses your microphone while taking video of your product for uploading in listing information.",
        "CFBundleAllowMixedLocalizations": true,
        "UIBackgroundModes": ["remote-notification"],
        "SKAdNetworkItems": [
          {
            "SKAdNetworkIdentifier": "cstr6suwn8.skadnetwork"
          },
          {
            "SKAdNetworkIdentifier": "v9wttpbfk4.skadnetwork"
          },
          {
            "SKAdNetworkIdentifier": "n38lu8286g.skadnetwork"
          }
        ]
      },
      "googleServicesFile": "./GoogleService-Info.plist",
      "config": {
        "googleMapsApiKey": "AIzaSyBpEfX_PyYbLxGa07zjvLJbZefx",
        "usesNonExemptEncryption": false
      }
    },
    "android": {
      "package": "com.myabcapp",
      "config": {
        "googleMaps": {
          "apiKey": "AIzaSyBpEfX_PyYbLxGa07zjvLJbZefx"
        }
      },
      "googleServicesFile": "./google-services.json",
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#fff"
      },
      "permissions": [
        "CAMERA",
        "CAMERA_ROLL",
        "MEDIA_LIBRARY",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE",
        "RECORD_AUDIO",
        "READ_PHONE_STATE",
        "READ_CONTACTS",
        "LOCATION",
        "ACCESS_COARSE_LOCATION",
        "ACCESS_FINE_LOCATION",
        "RECEIVE_BOOT_COMPLETED",
        "com.google.android.gms.permission.AD_ID",
        "android.permission.INTERNET",
        "POST_NOTIFICATIONS"
      ],
      "versionCode": 31
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "scheme": "myabcapp",
    "extra": {
      "eas": {
        "projectId": "47c5dce0-69e9-4ebf-a637-89k9879j67j8"
      }
    }
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-789768768767698~899798798",
    "ios_app_id": "ca-app-pub-987989879879~9879879798"
  }
}

有人可以告诉我发生了什么以及为什么会发生吗?另外我该如何克服这个问题?

提前致谢。

android react-native expo google-play android-permissions
1个回答
0
投票
  • 您看到的警告消息与更新到 SDK 版本 50 后在 Expo 应用程序中使用 minSdkVersion 29 有关。Google Play 商店现在对新应用程序版本强制执行最低 minSdkVersion 为 30。您的 app.json 文件确实没有明确定义 minSdkVersion,这意味着它默认为 Expo 的 SDK 版本 48 中的值,即 29。但是,更新到 SDK 版本 50 后,默认值已更改为 30。由于您没有显式设置该值在您的 app.json 中,正在显示警告。

  • app.json 中更新的 Android 配置

    "android": {
     "package": "com.myabcapp",
     "config": {
      "googleMaps": {
        "apiKey": "AIzaSyBpEfX_PyYbLxGa07zjvLJbZefx"
      }
     },
     "googleServicesFile": "./google-services.json",
     "adaptiveIcon": {
      "foregroundImage": "./assets/adaptive-icon.png",
      "backgroundColor": "#fff"
     },
     "permissions": [
       "CAMERA",
       "CAMERA_ROLL",
       "MEDIA_LIBRARY",
       "READ_EXTERNAL_STORAGE",
       "WRITE_EXTERNAL_STORAGE",
       "RECORD_AUDIO",
       "READ_PHONE_STATE",
       "READ_CONTACTS",
       "LOCATION",
       "ACCESS_COARSE_LOCATION",
       "ACCESS_FINE_LOCATION",
       "RECEIVE_BOOT_COMPLETED",
       "com.google.android.gms.permission.AD_ID",
       "android.permission.INTERNET",
       "POST_NOTIFICATIONS"
      ],
      "minSdkVersion": 30,
      "versionCode": 31
    },
    
© www.soinside.com 2019 - 2024. All rights reserved.