Open wang333333333 opened 3 months ago
具体的报错呢?
failed to install the app
这不是报错,截图
删掉 e:\react\awesomeproject\android\.gradle
目录再重试
我也遇到了同样的问题,也尝试了删除.gradle,依然error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8082 FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'Web'. > Could not determine the dependencies of null. > Could not resolve all task dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:. Required by: project : > Could not resolve com.facebook.react:react-native-gradle-plugin. Required by: project : > No matching var iant of project :gradle-plugin was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies decl ared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.6' but: - Variant 'apiElements' capability com.facebook.react:react-native-gradle-plugin:unspeci fied declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compat ible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.ap i-version (required '8.6') - Variant 'mainSourceElements' capability com.facebook.react:react-native-gradle-plugin:unspecified declares a component, and its dependencies declared e xternally: - Incompatible because this component declares a component of category 'verification' and the consumer needed a library - Other compatible attributes: - Doesn't say anyt hing about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org .gradle.plugin.api-version (required '8.6') - Doesn't say anything about its usage (required runtime) - Variant 'runtimeElements' capability com.facebook.react:react-native-gradle- plugin:unspecified declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a componen t, compatible with Java 11 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (req uired '8.6') - Variant 'testResultsElementsForTest' capability com.facebook.react:react-native-gradle-plugin:unspecified: - Incompatible because this component declares a component of category 'verification' and the consumer needed a library - Other compatible attributes: - Doesn't say anything about how its dependencies are found (required its dependencies declared externally) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.6') - Doesn't say anything about its usage (required runtime) > Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:. Required by: project : * Try: > Review the variant matching algorithm at https://docs.gradle.org/8.6/userguide/variant_attributes.html#sec:abm_algorithm. > No matching variant errors are explained in more detail at https://docs.gradle.org/8.6/userguide/variant_model.html#sub:variant-no-match. > 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. BUILD FAILED in 5s.
info Run CLI with --verbose flag for more details.
还是一样报错
删掉
e:\react\awesomeproject\android\.gradle
目录再重试
@Cz2545481217 你的问题完全不一样,你的是jdk版本不对
@wang333333333 我查了下,好像是gradle 8.6的bug,
降级到8.5可解决
@wang333333333 我查了下,好像是gradle 8.6的bug,
降级到8.5可解决
降级到8.5也不行
降级到8.5之后 再删除.gradle 重新跑就可以了
确实降级之后就解决了 但是这个原理是什么 它报得是workspace 和 location
@sunnylqm 大佬,我这边将8.6降到8.5,并删除.gradle之后,重新运行,还是报错
使用命令npx react-native doctor
npx react-native info
求助大佬
@tgwstyle 这个报错不是很明确,之前大部分人是因为jdk版本不对,但看这里的说法也可能还是网络的问题 https://github.com/reactnativecn/react-native-website/issues/838#issuecomment-2252078065
E:\react\AwesomeProject>npx react-native info info Fetching system and libraries information... System: OS: Windows 10 10.0.19045 CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz Memory: 3.60 GB / 15.90 GB Binaries: Node: version: 18.15.0 path: E:\nvm\nodejs\node.EXE Yarn: version: 3.6.4 path: E:\nvm\nodejs\yarn.CMD npm: version: 9.5.0 path: E:\nvm\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Not Found Visual Studio: Not Found Languages: Java: 17.0.11 Ruby: Not Found npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.74.2 wanted: 0.74.2 react-native-windows: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: Not found newArchEnabled: Not found
javac版本 17.0.11