【问题标题】:React Native code is not running on Emulator in VS CodeReact Native 代码未在 VS Code 中的 Emulator 上运行
【发布时间】:2021-12-26 16:45:32
【问题描述】:

当我尝试使用 VS Code 中的命令运行代码但没有在其上运行代码时,模拟器可以正常打开。出了点问题,我无法解决。请帮忙! 以下是错误-

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:7884) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 870 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

FAILURE: Build failed with an exception.

* Where:
Settings file 'D:\OLA\OlaProject\android\settings.gradle'

* What went wrong:
Could not compile settings file 'D:\OLA\OlaProject\android\settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 60

settings.gradle

rootProject.name = 'OlaProject'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

gradle.properties

android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0

【问题讨论】:

    标签: react-native visual-studio-code android-emulator


    【解决方案1】:

    你能分享你的settings.gradleGradle-wrapper.properties 文件吗?

    可能是您使用的 gradle 版本有问题,尝试在 gradle-wrapper.properties 文件中更改您的 gradle 版本,看看它是否正常工作。

    同时检查 build.gradle 并查看 com.android.tools.build:gradle:x.x.x 是否与您当前的 gradle 版本兼容

    https://developer.android.com/studio/releases/gradle-plugin

    【讨论】:

    • 我已经更新了详细信息。我知道当前的 gradle5 版本与新项目中的 Java16 版本不兼容。但是在运行以前使用 java16 的项目时更新它们会导致错误。请帮忙!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-08
    • 2023-02-24
    • 1970-01-01
    • 1970-01-01
    • 2020-09-29
    • 2020-09-29
    • 2018-06-27
    相关资源
    最近更新 更多