任务 app:compileDebugJavaWithJavac 失败。

6
尝试在安卓上运行React Native应用程序时,我遇到了以下错误:
失败:出现异常构建失败。
出了什么问题? 执行任务':@react-native-firebase_app:compileDebugJavaWithJavac'失败。 编译失败,请查看编译器错误输出以获取详细信息。
构建失败的错误链接 link 如果我注释掉react-native-firebase_app包,则其他一些包也会返回相同的错误。
示例: `
> Task :amazon-cognito-identity-js:compileDebugJavaWithJavac FAILED
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:7: error: package com.facebook.react does not exist
import com.facebook.react.ReactPackage;
                         ^
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:8: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.NativeModule;
                                ^
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:9: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.ReactApplicationContext;
                                ^
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:10: error: package com.facebook.react.uimanager does not exist
import com.facebook.react.uimanager.ViewManager;
                                   ^
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:11: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.JavaScriptModule;
                                ^
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:13: error: cannot find symbol
public class RNAWSCognitoPackage implements ReactPackage {
                                            ^
  symbol: class ReactPackage
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:15: error: cannot find symbol
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
                                                  ^
  symbol:   class ReactApplicationContext
  location: class RNAWSCognitoPackage
/Users/spurge/Music/ghoshak_owner/node_modules/amazon-cognito-identity-js/android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java:15: error: cannot find symbol
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
                ^
  symbol:   class NativeModule
  location: class RNAWSCognitoPackage

`

Android/build.gradle

`

ext {
    var = '3.1.1'
    var1 = '3.6.3'
}
buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 21
        compileSdkVersion = 28
        targetSdkVersion = 30
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.6.0"
        googlePlayServicesAuthVersion = "19.2.0" // <--- use this version or newer

    }
    repositories {
        google()
        jcenter()
        mavenLocal()
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.3'
        classpath 'com.google.gms:google-services:4.3.14'

    //  classpath 'com.android.tools.build:gradle:4.2.1' // <--- use this version or newer
    //     classpath 'com.google.gms:google-services:4.3.10'

    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        mavenCentral()
         maven { url 'https://maven.google.com' }
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url 'https://jitpack.io' }
    }
}
subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion 29
                buildToolsVersion "28.0.3"
                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (names.contains("reactNative51") || names.contains("reactNative55")) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

` Android/app/build.gradle

`

apply plugin: "com.android.application"
import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js",
    // bundleCommand: "ram-bundle",
    // bundleAssetName: "index.android.bundle",
    // bundleInAlpha: true,
    // bundleInBeta: true
]

apply from: "../../node_modules/react-native/react.gradle"

project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ] // Name of the font files you want to copy
]

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


    // configurations {
    //     exclude group: 'com.google.zxing'
    // }


  packagingOptions {
     pickFirst 'lib/x86/libc++_shared.so'
     pickFirst 'lib/x86_64/libjsc.so'
     pickFirst 'lib/arm64-v8a/libjsc.so'
     pickFirst 'lib/arm64-v8a/libc++_shared.so'
     pickFirst 'lib/x86_64/libc++_shared.so'
     pickFirst 'lib/armeabi-v7a/libc++_shared.so'
   }
    defaultConfig {
        applicationId "com.ghoshak_owner"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57" // See note below!
        versionCode 188
        versionName "1.0.5"
        multiDexEnabled true
    }

    signingConfigs {
        debug {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
       
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            shrinkResources  enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
    dexOptions {
    incremental true
    javaMaxHeapSize "2048M"
    jumboMode = true
}
}

configurations {
compile.exclude group: 'com.google.zxing'
 compile.exclude group: "junit", module: "junit"
}

dependencies {
    implementation project(':react-native-bluetooth-escpos-printer')
    implementation project(':react-native-google-signin')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-view-shot')
    // implementation project(':@react-native-community_toolbar-android')
    // implementation project(':@react-native-firebase_dynamic-links')
    // implementation project(':@react-native-firebase_app')
    // implementation project(':react-native-safe-area-context')
    // implementation project(':react-native-reanimated')
    implementation project(':react-native-localization')
    // implementation project(':@leesiongchan_react-native-esc-pos')
    implementation project(':react-native-notification-sounds')
    implementation project(':react-native-image-resizer')
    implementation project(':react-native-charts-wrapper')
    implementation project(':react-native-razorpay')
    implementation project(':react-native-device-info')
    implementation project(':react-native-html-to-pdf')
    implementation project(':react-native-share')
    implementation project(':react-native-pdf-lib')
    implementation project(':react-native-google-places')
    // implementation project(':react-native-camera')
    implementation project(':react-native-maps')
    implementation project(':react-native-pdf')
    implementation project(':rn-fetch-blob')
    // implementation project(':@philly25_react-native-paytm')
    implementation project(':react-native-webview')
    implementation project(':react-native-youtube')
    implementation project(':react-native-camera-kit')
    implementation project(':react-native-push-notification')
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-svg')
    implementation project(':react-native-vector-icons')
    implementation project(':amazon-cognito-identity-js')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-navigation')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-geolocation-service')
    // implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:multidex:1.0.3'
      // For WebP support, including animated WebP
    implementation 'com.facebook.fresco:animated-webp:1.3.0'
    implementation 'com.facebook.fresco:webpsupport:1.3.0' 
    // For WebP support, without animations
    compile 'com.facebook.fresco:webpsupport:1.3.0'
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
    implementation 'com.facebook.fresco:webpsupport:1.3.0'
    // implementation project(path: ":@react-native-firebase_app")
    // implementation project(path: ":@react-native-firebase_dynamic-links")
    // implementation project(':react-native-esc-pos')
    implementation 'com.android.support:support-compat:+'

   

     implementation 'com.google.android.play:core:1.8.2'
        implementation 'com.google.android.material:material:1.2.1'

        implementation 'com.android.support:design:25.1.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' // <-- add this; newer versions should work too

    // implementation platform('com.google.firebase:firebase-bom:26.5.0')
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}
 //apply plugin: 'com.google.gms.google-services'

` setting.gradle

`

rootProject.name = 'ghoshak_owner'
include ':react-native-bluetooth-escpos-printer'
project(':react-native-bluetooth-escpos-printer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bluetooth-escpos-printer/android')
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-view-shot'
project(':react-native-view-shot').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-view-shot/android')
// include ':@react-native-community_toolbar-android'
// project(':@react-native-community_toolbar-android').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/toolbar-android/android')
// include ':@react-native-firebase_dynamic-links'
// project(':@react-native-firebase_dynamic-links').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/dynamic-links/android')
// include ':@react-native-firebase_app'
// project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android')
// include ':react-native-safe-area-context'
// project(':react-native-safe-area-context').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-safe-area-context/android')
// include ':react-native-reanimated'
// project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-localization'
project(':react-native-localization').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localization/android')
// include ':@leesiongchan_react-native-esc-pos'
// project(':@leesiongchan_react-native-esc-pos').projectDir = new File(rootProject.projectDir, '../node_modules/@leesiongchan/react-native-esc-pos/android')
include ':react-native-notification-sounds'
project(':react-native-notification-sounds').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notification-sounds/android')
include ':react-native-image-resizer'
project(':react-native-image-resizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-resizer/android')
include ':react-native-charts-wrapper'
project(':react-native-charts-wrapper').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-charts-wrapper/android')
include ':react-native-razorpay'
project(':react-native-razorpay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-razorpay/android')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':react-native-html-to-pdf'
project(':react-native-html-to-pdf').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-html-to-pdf/android')
include ':react-native-share'
project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
include ':react-native-pdf-lib'
project(':react-native-pdf-lib').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pdf-lib/android')
include ':react-native-google-places'
project(':react-native-google-places').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-places/android')
// include ':react-native-camera'
// project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':react-native-pdf'
project(':react-native-pdf').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pdf/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
// include ':@philly25_react-native-paytm'
// project(':@philly25_react-native-paytm').projectDir = new File(rootProject.projectDir, '../node_modules/@philly25/react-native-paytm/android')
include ':react-native-webview'
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
include ':react-native-youtube'
project(':react-native-youtube').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-youtube/android')
include ':react-native-camera-kit'
project(':react-native-camera-kit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera-kit/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':amazon-cognito-identity-js'
project(':amazon-cognito-identity-js').projectDir = new File(rootProject.projectDir, '../node_modules/amazon-cognito-identity-js/android')
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(settingsDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = file('../node_modules/react-native-push-notification/android')
include ':react-native-splash-screen'   
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-geolocation-service'
project(':react-native-geolocation-service').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-geolocation-service/android')

// include ':@react-native-firebase_app'
// project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/app/android')
// include ':@react-native-firebase_dynamic-links'
// project(':@react-native-firebase_dynamic-links').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/dynamic-links/android')

// include ':react-native-esc-pos'
// project(':react-native-esc-pos').projectDir = new File(rootProject.projectDir,   '../node_modules/@leesiongchan/react-native-esc-pos/android')
include ':app'

`

3个回答

8
请在android/build.gradle文件中添加以下行。
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
     
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }
   // other code
}

https://github.com/facebook/react-native/issues/35204#issuecomment-1304281740


2
非常感谢你,Shivam。这个解决方案对我很有帮助,我已经困扰了两个小时,而你的解决方案让它工作了。 - amit pandya
嘿,我的build.gradle已经有这个了。只是要补充说明这个答案不完整。 - Lauro235

2

由于React Native版本0.71.0-rc0的发布,Android构建将会失败。

方法1

请按照以下步骤将此修复方法添加到您的android -> build.gradle文件中:

buildscript {
    // ...
}


allprojects {
    repositories {
       exclusiveContent {
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }
        // ...
    }
}

这个修复操作会应用一条“exclusiveContent resolution rule”,强制解析 React Native Android 库时使用 node_modules 中的库。注意,这个修复操作是为了解决自 2022 年 11 月 4 日以来出现的 Android 构建失败问题 #35210。
方法 2:如果你的 gradle 不支持上述操作,则可以在 android -> build.gradle 文件中添加如下内容:
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())


buildscript {
     // ...
}
    
    
allprojects {
    configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
          }
    }
    // ...  
}

参考:https://github.com/facebook/react-native/issues/35210#issuecomment-1304536693

以下是Thanhal提供的原始答案:


1
我参考了这个GitHub帖子:https://github.com/facebook/react-native/issues/35210。对我有用!
我遵循的步骤如下:
  • 删除node_modules文件夹
  • 将“react-native”包版本(在package.json文件中)从“0.70.1”更改为我在该帖子中找到的最新补丁版本(对我来说是“0.70.5”)
  • 运行npm install重新生成node_modules文件夹(如果您的项目基于yarn包,则可能要使用yarn install
  • 然后cd android && ./gradlew clean
  • 最后cd ..(返回根目录)并npm run android构建应用程序。
请注意,我遵循了React Native >= 0.63(版本)的说明。
希望这对其他人也有用!

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接