build文件夹下的文件已生成,不应编辑,无法重新构建android项目

Files under the build folder are generated and should not be edited, cannot re-build android project(build文件夹下的文件已生成,不应编辑,无法重新构建android项目)
本文介绍了build文件夹下的文件已生成,不应编辑,无法重新构建android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在编写一个 Android 应用程序,但它突然无法解析 MainActivity 中的符号 R.我以前遇到过这个问题,通常可以通过工具->android->syncProjectWithGradleFiles 解决,但这不起作用.相反,当我尝试这样做时,它会将我带到我的 AndroidManifest.xml 文件并给我消息:生成文件夹下的文件,不应编辑"如下图此外,这些错误显示如下:

I was programming an Android application when suddenly it was unable to resolve symbol R in my MainActivity. I have had this issue before and it is usually fixed by going to tools->android->syncProjectWithGradleFiles but this did not work. Instead when I attempt to do this it takes me to my AndroidManifest.xml file and gives me the message: "Files under the build folder are generated and should not be edited" shown below Furthermore, these errors are displayed below:

这些错误表明:没有找到与给定名称匹配的资源(在图标"处,值为@drawable/icon").这是我最近尝试添加的一项服务的一部分.所以我尝试在这里删除服务文本;但是,每当我删除服务文本时,每当我尝试再次将项目与 gradle 文件同步时,它就会不断被重新添加到 .xml 文件中.我已经重新构建了项目并清理了项目都返回了相同的错误...谁能帮我解决这个问题?

These errors specify that: No resource found that matches the given name (at 'icon' with value '@drawable/icon'). which is part of a service I recently tried to add. So I tried deleting the service text here; however whenever I delete the service text, it keeps being re-added to the .xml file whenever I attempt to sync the projects with gradle files again. I have re-built the project and cleaned the project both returning the same errors... Can anyone help me fix this?

推荐答案

这是因为你试图修改AndroidManifest的错误版本.当 Android Studio 发现错误时,它会向您显示位于 build 文件夹中的文件.打开app/src/main/AndroidManifest.xml,进行修改.

This is because you are trying to modify the wrong version of AndroidManifest. Android Studio shows you the file located in the build folder when it finds errors. Open app/src/main/AndroidManifest.xml and modify it.

这篇关于build文件夹下的文件已生成,不应编辑,无法重新构建android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending a keyboard event from java to any application (on-screen-keyboard)(将键盘事件从 java 发送到任何应用程序(屏幕键盘))
How to make JComboBox selected item not changed when scrolling through its popuplist using keyboard(使用键盘滚动其弹出列表时如何使 JComboBox 所选项目不更改)
Capturing keystrokes without focus(在没有焦点的情况下捕获击键)
How can I position a layout right above the android on-screen keyboard?(如何将布局放置在 android 屏幕键盘的正上方?)
How to check for key being held down on startup in Java(如何检查在Java中启动时按住的键)
Android - Get keyboard key press(Android - 获取键盘按键)