简体   繁体   English

在 Android Studio 中编辑 AndroidManifest.xml 上的错误

[英]Edit error on AndroidManifest.xml in Android Studio

My AndroidManifest.xml has an error:我的AndroidManifest.xml有一个错误:

<activity
    android:name="bla.bla.Activity"
    android:label="@string/title_activity_" >
</activity>

That activity doesn't exist anymore nor the string.该活动不再存在,字符串也不存在。 Since I can't edit the AndroidManifest.xml and it would regenerate that code again, how can I fix this?由于我无法编辑AndroidManifest.xml并且它会再次重新生成该代码,我该如何解决这个问题?

PS: Already tried cleaning the project a few times. PS:已经尝试清理项目几次了。 Using Windows.使用 Windows。

Since I can't edit the AndroidManifest.xml and it would regenerate that code again, how can I fix this?由于我无法编辑 AndroidManifest.xml 并且它会再次重新生成该代码,我该如何解决这个问题?

It very much sounds like you are editing the generated Manifest in the gen/ folder instead.听起来很像您正在gen/文件夹中编辑生成的清单。
If you make the changes to the 'regular' Manifest, it should work.如果您对“常规”清单进行更改,它应该可以工作。

If you use the default Android Studio project structure, the one you need to open is如果使用默认的 Android Studio 项目结构,则需要打开的是

在此处输入图片说明

我以前遇到过这个问题,您可以通过记事本打开 AndroidManifest.xml 并编辑,它会起作用

我手动找到了 app>src>main 文件夹中的 AndroidManifest.xml...然后用记事本++或括号打开它(就像他说的那样)然后删除行:android:theme="@Style/AppTheme" 然后没有错误出现。

In my case there was a bug of Android Studio.就我而言,Android Studio 存在错误。 I pressed File > Invalidate > Invalidate and Restart , then reopened Android Studio, and AndroidManifest became editable.我按下File > Invalidate > Invalidate and Restart ,然后重新打开 Android Studio,AndroidManifest 变得可编辑。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM