$ yarn android
yarn run v1.22.22
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1990 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
at makeError (/Users/.../app/node_modules/execa/index.js:174:9)
at /Users/.../app/node_modules/execa/index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (/Users/.../app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/.../app/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Я использую:
Узел: v18.20.3
Yarn: 1.22.22
Java: Java-версия «17.0.10» 16 января 2024 г. LTS
react-native: 0.69.4< /li>
реакция: 18.0.0
android 13 (эмулятор)
ОС: MacOS Sonoma 14.4 (M1)
Проект запускается впервые и в файле package.json имеются следующие версии:
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
googlePlayServicesAuthVersion = "19.2.0"
kotlinVersion = "1.6.10"
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.6.1") // I made the verion changes here between 7.6 and 7.6.1
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
попробуйте скачать и добавить файл gradle-wrapper-7.6.jar по пути: android/gradle/wrapper/gradle- обертка-7.6.jar, но результат тот же.
Я также пытался пересобрать градиент с помощью команды ./ обертка gradlew и возвращает эту ошибку
./gradlew wrapper
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Я пытался изменить версию gradlew в файлах gradle-wrapper.properties и android/build.gradle и добавить gradle.wrapper в версии 7.6.1 но ошибка сохраняется.
У меня проблема с запуском собственного проекта React, я использую Yarn, но ошибка также отображается с помощью npm: [code]$ yarn android
yarn run v1.22.22 $ react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 1990 file(s) to forward-jetify. Using 8 workers... info JS server already running. info Installing the app... Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
at makeError (/Users/.../app/node_modules/execa/index.js:174:9) at /Users/.../app/node_modules/execa/index.js:278:16 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async runOnAllDevices (/Users/.../app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5) at async Command.handleAction (/Users/.../app/node_modules/@react-native-community/cli/build/index.js:192:9) info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [/code] Я использую: [list] [*]Узел: v18.20.3 [*] Yarn: 1.22.22 [*]Java: Java-версия «17.0.10» 16 января 2024 г. LTS [*]react-native: 0.69.4< /li> реакция: 18.0.0 [*]android 13 (эмулятор) [*]ОС: MacOS Sonoma 14.4 (M1) [/list] Проект запускается впервые и в файле package.json имеются следующие версии: [code]{ "private": true, ... "dependencies": { "@invertase/react-native-apple-authentication": "^2.2.2", "@react-native-async-storage/async-storage": "^1.17.10", "@react-native-google-signin/google-signin": "^8.0.0", "@react-native-picker/picker": "^2.4.4", "@react-navigation/bottom-tabs": "^6.3.3", "@react-navigation/native": "^6.0.12", "@react-navigation/native-stack": "^6.8.0", "@reduxjs/toolkit": "^1.8.5", "axios": "^0.27.2", "jwt-decode": "^3.1.2", "moment": "^2.29.4", "react": "18.0.0", "react-hook-form": "^7.35.0", "react-native": "0.69.4", "react-native-calendars": "^1.1289.0", "react-native-confirmation-code-field": "6", "react-native-date-picker": "^4.2.5", "react-native-fbsdk-next": "^10.1.0", "react-native-gesture-handler": "^2.8.0", "react-native-get-location": "^2.2.1", "react-native-image-picker": "^4.10.0", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-linear-gradient": "^2.6.2", "react-native-maps": "^1.7.1", "react-native-modal": "^13.0.1", "react-native-modalize": "^2.1.1", "react-native-onesignal": "^4.4.1", "react-native-pager-view": "^6.1.4", "react-native-picker-select": "^8.0.4", "react-native-qrcode-svg": "^6.1.2", "react-native-rename": "^3.2.12", "react-native-safe-area-context": "^4.3.3", "react-native-screens": "^3.18.2", "react-native-simple-encryption": "^1.2.1", "react-native-svg": "^13.9.0", "react-native-switch-selector": "^2.2.1", "react-native-tab-view": "^3.5.1", "react-native-vision-camera": "^2.14.1", "react-redux": "^8.0.2" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.70.3", "react-test-renderer": "18.0.0" }, "jest": { "preset": "react-native" } } [/code] А это содержимое файла gradle-wrapper.properties [code]distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists [/code] и это содержимое android/build.gradle [code]buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 googlePlayServicesAuthVersion = "19.2.0" kotlinVersion = "1.6.10"
if (System.properties['os.arch'] == "aarch64") { // For M1 Users we need to use the NDK 24 which added support for aarch64 ndkVersion = "24.0.8215888" } else { // Otherwise we default to the side-by-side NDK version from AGP. ndkVersion = "21.4.7075529" } } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle:7.6.1") // I made the verion changes here between 7.6 and 7.6.1 classpath("com.facebook.react:react-native-gradle-plugin") classpath("de.undercouch:gradle-download-task:5.0.1") classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" classpath 'com.google.gms:google-services:4.3.10' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }
allprojects { repositories { maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } mavenCentral { // We don't want to fetch react-native from Maven Central as there are // older versions over there. content { excludeGroup "com.facebook.react" } } google() maven { url 'https://www.jitpack.io' } } } [/code] [list] [*]попробуйте скачать и добавить файл gradle-wrapper-7.6.jar по пути: android/gradle/wrapper/gradle- обертка-7.6.jar, но результат тот же.
[*]Я также пытался пересобрать градиент с помощью команды ./ обертка gradlew и возвращает эту ошибку
[/list] [code]./gradlew wrapper Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain [/code] Я пытался изменить версию gradlew в файлах gradle-wrapper.properties и android/build.gradle и добавить gradle.wrapper в версии 7.6.1 но ошибка сохраняется.
Я довольно новичок в Java, и я столкнулся с ошибкой, которую я просто не могу выяснить! (или любая команда ./mvnw на самом деле!) Я сталкиваюсь с следующей ошибкой:
Exception in thread main java.lang.IllegalStateException:...
Я довольно новичок в Java, и я столкнулся с ошибкой, которую я просто не могу выяснить! (или любая команда ./mvnw на самом деле!) Я сталкиваюсь с следующей ошибкой:
Exception in thread main java.lang.IllegalStateException:...
Я довольно новичок в Java, и я столкнулся с ошибкой, которую я просто не могу выяснить! (или любая команда ./mvnw на самом деле!) Я сталкиваюсь с следующей ошибкой:
Exception in thread main java.lang.IllegalStateException:...