SDK 39 / Android 构建失败,“未提供 <appAuthRedirectScheme> 的值”

Whi*_*eld 1 android react-native expo

在托管工作流项目中构建成功。弹出后,构建Android时出现错误。

环境

   Expo CLI 3.27.3 environment info:
    System:
      OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
      Shell: 5.8 - /usr/bin/zsh
    Binaries:
      Node: 14.10.0 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/bin/yarn
      npm: 6.14.5 - ~/.npm-global/bin/npm
      Watchman: 4.9.0 - /usr/bin/watchman
    npmPackages:
      expo: ^39.0.0 => 39.0.3 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: ~0.63.3 => 0.63.3 
      react-native-web: ~0.13.7 => 0.13.17 
    Expo Workflow: bare
Run Code Online (Sandbox Code Playgroud)

包.json

 "dependencies": {
    "expo": "^39.0.0",
    "expo-splash-screen": "~0.6.1",
    "expo-status-bar": "~1.0.2",
    "expo-updates": "~0.3.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "~0.63.3",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-reanimated": "~1.13.0",
    "react-native-screens": "~2.10.1",
    "react-native-unimodules": "~0.11.0",
    "react-native-web": "~0.13.7",
    "@eva-design/eva": "^2.0.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.6",
    "@react-navigation/bottom-tabs": "^5.6.1",
    "@react-navigation/native": "^5.6.1",
    "@react-navigation/stack": "^5.6.2",
    "@ui-kitten/components": "^5.0.0",
    "@ui-kitten/eva-icons": "^5.0.0",
    "@ui-kitten/moment": "^5.0.0",
    "axios": "^0.19.2",
    "expo-apple-authentication": "~2.2.1",
    "expo-asset": "~8.2.0",
    "expo-av": "~8.6.0",
    "expo-blur": "~8.2.0",
    "expo-constants": "~9.2.0",
    "expo-device": "~2.3.0",
    "expo-facebook": "~9.0.0",
    "expo-file-system": "~9.2.0",
    "expo-font": "~8.3.0",
    "expo-google-app-auth": "^8.1.2",
    "expo-haptics": "~8.3.0",
    "expo-image-picker": "~9.1.0",
    "expo-in-app-purchases": "~9.0.0",
    "expo-linear-gradient": "~8.3.0",
    "expo-linking": "^1.0.3",
    "expo-localization": "~9.0.0",
    "expo-notifications": "~0.7.2",
    "expo-permissions": "~9.3.0",
    "expo-screen-orientation": "~2.0.0",
    "expo-web-browser": "~8.5.0",
    "lodash": "^4.17.15",
    "mobx": "^5.15.4",
    "mobx-react": "^6.2.2",
    "moment": "^2.27.0",
    "moment-timezone": "^0.5.31",
    "prop-types": "^15.7.2",
    "react-native-confirmation-code-field": "^6.5.0",
    "react-native-eva-icons": "^1.3.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.2",
    "react-native-masked-text": "^1.13.0",
    "react-native-render-html": "^4.2.2",
    "react-native-safe-area-context": "3.1.4",
    "react-native-slider": "^0.11.0",
    "react-native-svg": "12.1.0",
    "react-native-webview": "10.7.0",
    "sentry-expo": "^2.1.2"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "babel-jest": "~25.2.6",
    "jest": "~25.2.6",
    "react-test-renderer": "~16.13.1",
    "@babel/runtime": "^7.10.3",
    "@svgr/cli": "^5.4.0",
    "babel-eslint": "^10.1.0",
    "babel-plugin-module-resolver": "^4.0.0",
    "babel-preset-expo": "^8.3.0",
    "eslint": "^7.3.1",
    "eslint-config-airbnb-base": "^14.2.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-react": "^7.20.2",
    "eslint-plugin-react-native": "^3.8.1",
    "jest-expo": "^39.0.0"
  },
Run Code Online (Sandbox Code Playgroud)

应用程序.json

    {
  "expo": {
    "name": ...,
    "slug": ...,
    "version": "1.0.4",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "splash": {
      "backgroundColor": "#f3dee9"
    },
    "ios": {
      "bundleIdentifier": ...,
      "buildNumber": "1.1.0",
      "usesAppleSignIn": true,
      "supportsTablet": false,
      "infoPlist": {
        "UIBackgroundModes": [
          "audio"
        ]
      },
      "requireFullScreen": true,
      "config": {
        "googleSignIn": {
          "reservedClientId": ...
        }
      },
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "android": {
      "package": ...,
      "versionCode": 6,
      "useNextNotificationsApi": true,
      "permissions": [],
      "config": {
        "googleSignIn": {
          "apiKey": ...,
          "certificateHash": ...
        }
      },
      "googleServicesFile": "./google-services.json"
    },
    "facebookScheme": ...,
    "facebookAppId": ...,
    "facebookDisplayName": ...,
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": ...,
            "project": ...,
            "authToken": ...
          }
        }
      ]
    },
    "sdkVersion": "39.0.0",
    "platforms": [
      "ios",
      "android"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

重现步骤

  1. 从托管工作流程中弹出(expo 弹出)
  2. 根据说明进行签名和汇编:https ://reactnative.dev/docs/signed-apk-android

预期行为

项目构建成功

实际行为

构建失败,原因如下:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseManifest'.
> Manifest merger failed : Attribute data@scheme at AndroidManifest.xml requires a placeholder substitution but no value for <appAuthRedirectScheme> is provide
Run Code Online (Sandbox Code Playgroud)

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Run Code Online (Sandbox Code Playgroud)

小智 5

在应用程序/build.gradle中:

defaultConfig {
    applicationId 'com.example'
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0.0"
    manifestPlaceholders = [appAuthRedirectScheme: 'com.example'] //add this!
}
Run Code Online (Sandbox Code Playgroud)