简体   繁体   English

更新到 Android Studio 4.2 后无法构建我的项目

[英]Cannot build my project after updating to Android Studio 4.2

I have recently upgraded to Android Studio 4.2.我最近升级到 Android Studio 4.2。 I can no longer build my project.我无法再构建我的项目。

Android Studio non-stop trying to start Gradle Daemon , but cannot do so: Android Studio 不停地尝试启动Gradle Daemon ,但不能这样做:

Starting Gradle Daemon...
Gradle Daemon started in 5 s 92 ms
Starting Gradle Daemon...
Gradle Daemon started in 4 s 406 ms
Starting Gradle Daemon...
Gradle Daemon started in 2 s 968 ms
Starting Gradle Daemon...
Gradle Daemon started in 2 s 937 ms
Starting Gradle Daemon...

I think as a result of this, dozens of OpenJDK Platform binaries are being generated in my TaskManager .我认为因此,我的TaskManager中生成了数十个OpenJDK Platform binaries This processes never stops until my machine runs out of memory.这个过程永远不会停止,直到我的机器用完 memory。 In such cases, very frequently, Android Studio is crashing.在这种情况下,Android Studio 经常崩溃。

在此处输入图像描述

When I do get to point where Android Studio stops building, it shows me an error: (I am sorry I am posting error image. My laptop is frozen that it is not possible to copy the error message.)当我确实到达 Android Studio 停止构建的位置时,它向我显示一个错误:(对不起,我发布了错误图像。我的笔记本电脑被冻结,无法复制错误消息。)

在此处输入图像描述

Studio tries to import previous.vmoptions and sanitize them to work with the garbage collector used by JDK 11. If that process fails, the IDE may not start for certain users who set custom VM options in the.vmoptions file. Studio 尝试导入 previous.vmoptions 并清理它们以与 JDK 11 使用的垃圾收集器一起使用。如果该过程失败,IDE 可能无法为某些在 .vmoptions 文件中设置自定义 VM 选项的用户启动。

In order to resolve this problem, try:为了解决此问题,请尝试:

We recommend commenting out custom options in.vmoptions (using the “#” character).我们建议在 .vmoptions 中注释掉自定义选项(使用“#”字符)。 The.vmoptions file can be found in the following locations:可以在以下位置找到 .vmoptions 文件:

Windows Windows

C:\Users\YourUserName\AppData[Local|Roaming]\Google\AndroidStudio4.2\studio64.exe.vmoptions C:\Users\YourUserName\AppData[Local|Roaming]\Google\AndroidStudio4.2\studio64.exe.vmoptions

Check out the docs for more known issues of Android Studio 4.2 https://developer.android.com/studio/known-issues查看文档以了解 Android Studio 4.2 https://developer.android.com/studio/known-issues的更多已知问题

Potential solutions:潜在的解决方案:

Solution 1.解决方案 1。

Restart your machine.重新启动您的机器。 Then re-open your project.然后重新打开您的项目。 It should fix the issues.它应该解决问题。

Solution 2.解决方案 2。

It is possible that Android Studio 4.2 is having issues due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin Android Studio 4.2 可能由于从先前版本的 Android Studio 导入的无效 Android Studio 配置或不兼容的插件而出现问题

Go to these folders: Go 到这些文件夹:

C:\Users\YourUserName\AppData\Local\Google
C:\Users\YourUserName\AppData\Roaming\Google

Find Android Studio 4.1 or similar directory of previous version of Android Studio.找到Android Studio 4.1或之前版本 Android Studio 的类似目录。 Delete (or rename, for backup purposes) the directory, depending on the Android Studio version, and start Android Studio again.根据 Android Studio 版本删除(或重命名,用于备份)目录,然后再次启动 Android Studio。

Try opening build.gradle and there at the top you will see JDK not recognized dialog click on it and choose your JDK.尝试打开 build.gradle 并在顶部看到 JDK 无法识别对话框单击它并选择您的 JDK。 It will work.它会起作用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio。 更新后无法编译/构建我的项目 - Android Studio. Cannot compile/ build my project after updating 在Android Studio中更新android项目后,我的gradle构建未运行 - My gradle build is not running after updating the android project in android studio 更新Android Studio库后,我无法运行或构建项目 - After updating Android studio library I cannot run or build project 将 android 工作室更新到 4.2 Beta1 后 Gradle 构建失败 - Gradle build failed after updating android studio to 4.2 Beta1 更新Android Studio后无法构建 - Cannot build after updating Android Studio 更新到 Android Studio 4.2 后无法创建新的 Kotlin 项目 - Can't create new Kotlin project after updating to Android Studio 4.2 更新android studio 3.0后无法构建项目 - After updating android studio 3.0 unable to build the project android:将Android Studio升级到2.3后无法构建项目 - android : cannot build project after upgrading Android Studio to 2.3 更新Android Studio 3.0 Stable之后,我在新的Gradle中迁移项目,而在构建时遇到问题 - After updating Android Studio 3.0 Stable and i migrate my project in new gradle i am facing issue while build Android studio 更新 4.2 后未显示工具栏选项 - Android studio not showing Toolbar option after updating 4.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM