【问题标题】:settings.gradle error for react native app反应本机应用程序的settings.gradle错误
【发布时间】:2022-01-07 08:14:10
【问题描述】:

这是我的settings.gradle 文件

rootProject.name = 'myappname'

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
useExpoModules()

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesSettingsGradle(settings)

include ':app'

运行./gradlew clean./gradlew bundleRelease 时出现此错误:

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/username/Desktop/myappname/android/settings.gradle' line: 2

* What went wrong:
A problem occurred evaluating settings 'myappname'.
> String index out of range: 0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

知道如何解决这个问题吗?

【问题讨论】:

  • 这只是告诉构建失败并出现异常。那个例外是什么?可以运行 ./gradlew bundleRelease --info 或 --debug 选项来获取有关错误的更多信息。

标签: android react-native gradle


【解决方案1】:

确保 package.json 中的 expo 版本设置为:

"expo": "^43.0.1",

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-30
    • 1970-01-01
    • 2018-01-15
    • 2019-10-01
    • 2019-12-06
    相关资源
    最近更新 更多