react-native-braintree-dropin-ui:-source 7 不支持 lambda 表达式

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

我在我的机器上使用 openJDK 11。我最近将react-native-braintree-dropin-ui 包更新到最新版本。现在,它在 RNBraintreeDropInModule.java 文件中使用 lambda 表达式。因此,当我运行 npm run android 时,构建失败并提示:

react-native-braintree-dropin-ui/android/src/main/java/tech/power/RNBraintreeDropIn/RNBraintreeDropInModule.java:41: error: lambda expressions are not supported in -source 7
            callback -> {
                     ^
  (use -source 8 or higher to enable lambda expressions)
1 error

有人可以帮我吗?谢谢!

我尝试在 app/build.gradle 文件中设置 VERSION_11 但没有成功。

 compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
reactjs react-native braintree
1个回答
0
投票

我添加了

compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

到 Braintree npm 包的 android build.gradle。在构建应用程序之前,我也使用

patch-package
来更新 build.gradle。

© www.soinside.com 2019 - 2024. All rights reserved.