Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle 8.6在windows下可能存在bug,需降级到8.5 #848

Open
wang333333333 opened this issue Jun 18, 2024 · 16 comments
Open

gradle 8.6在windows下可能存在bug,需降级到8.5 #848

wang333333333 opened this issue Jun 18, 2024 · 16 comments

Comments

@wang333333333
Copy link

wang333333333 commented Jun 18, 2024

image


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

@sunnylqm
Copy link

具体的报错呢?

@wang333333333
Copy link
Author

wang333333333 commented Jun 18, 2024

failed to install the app

@sunnylqm
Copy link

这不是报错,截图

@wang333333333
Copy link
Author

微信图片_20240618191834

@wang333333333
Copy link
Author

微信图片_20240618191924

@sunnylqm
Copy link

sunnylqm commented Jun 18, 2024

删掉 e:\react\awesomeproject\android\.gradle 目录再重试

@Cz2545481217
Copy link

我也遇到了同样的问题,也尝试了删除.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.

@wang333333333
Copy link
Author

image
还是一样报错

删掉 e:\react\awesomeproject\android\.gradle 目录再重试

@wang333333333
Copy link
Author

image

@sunnylqm
Copy link

@Cz2545481217 你的问题完全不一样,你的是jdk版本不对

@sunnylqm
Copy link

@wang333333333 我查了下,好像是gradle 8.6的bug,

image

降级到8.5可解决

@sunnylqm sunnylqm changed the title 按照官方文档创建项目一直报错 gradle 8.6在windows下可能存在bug,需降级到8.5 Jun 19, 2024
@sunnylqm sunnylqm pinned this issue Jun 19, 2024
@wang333333333
Copy link
Author

@wang333333333 我查了下,好像是gradle 8.6的bug,

image 降级到8.5可解决

image
降级到8.5也不行

@wang333333333
Copy link
Author

降级到8.5之后 再删除.gradle 重新跑就可以了

@blackHairSnow
Copy link

确实降级之后就解决了 但是这个原理是什么 它报得是workspace 和 location

@tgwstyle
Copy link

@sunnylqm
大佬,我这边将8.6降到8.5,并删除.gradle之后,重新运行,还是报错
image

使用命令npx react-native doctor
image

npx react-native info
image

求助大佬

@sunnylqm
Copy link

@tgwstyle 这个报错不是很明确,之前大部分人是因为jdk版本不对,但看这里的说法也可能还是网络的问题
#838 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants