简体   繁体   English

错误:Android 源生成器:[项目] 找不到 AndroidManifest.xml 文件

[英]ERROR: Android Source Generator: [project] AndroidManifest.xml file not found

I am a newbie to android , using intellij idea.我是 android 的新手,使用 Intellij 的想法。 when I want to compile my hello-world ( the first step ;) ) I faced with this error "Android Source Generator: [project] AndroidManifest.xml file not found"当我想编译我的 hello-world(第一步;))时,我遇到了这个错误“Android Source Generator: [project] AndroidManifest.xml file not found”

Of course it is not in my root file.当然它不在我的根文件中。 And when I make any new project , I have the same problem.当我做任何新项目时,我都会遇到同样的问题。

I searched a lot and even find this " AndroidManifest.xml file not found " but not help.我搜索了很多,甚至找到了这个“找不到AndroidManifest.xml 文件”,但没有帮助。

plz help .请帮忙。

you must open Project Structure modified something.你必须打开项目结构修改一些东西。

example: Project Structure > Facets ,you can see this is:例如:Project Structure > Facets ,你可以看到这是:在此处输入图片说明

delete ".idea", like this删除“.idea”,像这样在此处输入图片说明

ok, IDE there find AndroidManifest.xml好的,IDE那里找到AndroidManifest.xml

I know the problem in IDEA because you create a new project with Java configuration (not android, but with android sdk dependency)我知道 IDEA 中的问题,因为您创建了一个带有 Java 配置的新项目(不是 android,而是带有 android sdk 依赖项)

File > New Project > Java (Java Module) > Project SDK Android 4.X

Here is the solution :这是解决方案:

File > New Project > Android (Application Module)

If you are using Maven , backup the project and close it.如果您正在使用 Maven ,请备份项目并关闭它。 Open IntelliJ and select Open..., choose the pom.xml file and then select yes to open this project.打开 IntelliJ 并选择 Open...,选择 pom.xml 文件,然后选择 yes 打开此项目。 Because there is already a project a popup should appear, choose 'Delete Existing Project and Import'.因为已经有一个项目,应该会出现一个弹出窗口,选择“删除现有项目并导入”。

Note: I'm using IntelliJ Community Edition version 13注意:我使用的是 IntelliJ Community Edition 版本 13

I believe this question is a duplicate of this question: AndroidManifest.xml file not found我相信这个问题是这个问题的重复: AndroidManifest.xml file not found

I used to have the same problem with Intellij 13 EAP, OS-X Mavericks, and a maven multi module Android project, where it was compiling fine by command line, but failing to rebuild/make thru the IDE.我曾经在 Intellij 13 EAP、OS-X Mavericks 和 maven 多模块 Android 项目中遇到过同样的问题,它通过命令行编译得很好,但无法通过 IDE 重建/制作。

Project Structure > Facets > select your Android project > 'Generated Sources' tab项目结构 > Facets > 选择你的 Android 项目 > 'Generated Sources' 标签

check "Run 'process-resources' Maven task before Make" option.选中“在 Make 之前运行‘process-resources’Maven 任务”选项。

Please check your Build Tools version, it must be same in build.gradle file, for example:请检查您的构建工具版本,它在 build.gradle 文件中必须相同,例如:

buildToolsVersion "19.0.3"

So, open Android SDK Manager, check your revision of Build Tools.因此,打开 Android SDK Manager,检查您的 Build Tools 版本。

After changes, go to Build -> Clean Project更改后,转到Build -> Clean Project

Go to the directory where you have installed Android SDK.转到您安装 Android SDK 的目录。 There, go to tools directory.在那里,转到tools目录。 Note down the path of tools directory.记下tools目录的路径。

Open command prompt/terminal, and cd to tools directory:打开命令提示符/终端,然后cd到工具目录:

cd <tools directory path>

Run command:运行命令:

android update project -p <path to project directory> -n <name of project> -t android-15

To create a new project:要创建一个新项目:

android create project -p <path to project directory> -n <name of project> -k <package name> -a <hello world activity name> -t <android version like: android-15>

There may be more than one answer to this.对此,答案可能不止一种。 Check that your Android project is not under another directory of the same name.检查您的 Android 项目是否不在另一个同名目录下。 Android Studio is easily confused by this. Android Studio 很容易被这个搞糊涂。

For example, change: /Development/MyProject/MyProject/app/...例如,更改:/Development/MyProject/MyProject/app/...

to this structure: /Development/MyProject/app/...到这个结构:/Development/MyProject/app/...

When I changed this in my own project, it went from refusing to build to doing an auto-build on opening the project.当我在自己的项目中更改此设置时,它从拒绝构建变为在打开项目时进行自动构建。 Hope this is useful.希望这是有用的。

Go File,Project Structure or press Ctrl+Shift+Alt+S,转到文件、项目结构或按 Ctrl+Shift+Alt+S,

Go Facets, Select your android project, in the structure there are configuration files, folders. Go Facets,选择你的android项目,在结构中有配置文件,文件夹。 Image of structure tab (before)结构选项卡的图像(之前)

Location of AndroidManifest file was like this: D:\\Programming\\Dart Flutter Projects\\tip_calculator\\AndroidManifest.xml AndroidManifest 文件的位置是这样的:D:\\Programming\\Dart Flutter Projects\\tip_calculator\\AndroidManifest.xml

Change the location like this.像这样改变位置。 Image of strcuture tab (after)结构选项卡的图像(后)

Changed it to here: D:\\Programming\\Dart Flutter Projects\\tip_calculator\\android\\app\\src\\profile\\AndroidManifest.xml改成这里:D:\\Programming\\Dart Flutter Projects\\tip_calculator\\android\\app\\src\\profile\\AndroidManifest.xml

Goto File -> New Project -> Android Project->continue and hit Finish.转到 File -> New Project -> Android Project->continue 并点击 Finish。

Now go to File -> Import existing file system现在转到文件 - >导入现有文件系统

我以这种方式解决了这个问题:我使用默认配置创建了另一个项目,并且没有关闭这个新项目,使用 Android 源生成器打开了旧项目:[项目] AndroidManifest.xml 文件未找到错误。

When I checkout an android project use Android Studio, I see the same problem.当我使用 Android Studio 签出一个 android 项目时,我看到了同样的问题。 I try to new an Android module in the project, then the problem solved.我尝试在项目中新建一个Android模块,然后问题解决了。

Simply, Move your project folder to default project directory简单地,将您的项目文件夹移动到默认的项目目录

/home/USER/AndroidStudioProjects/ /home/USER/AndroidStudioProjects/

This solves my issue .这解决了我的问题。 Hope This helps!!!希望这有帮助!!!

Open the Gradle Sync tab, check for any errors there.打开 Gradle Sync 选项卡,检查那里是否有任何错误。 If there is a link to "Install Repository and sync project" click it to install the missing components.如果有“安装存储库和同步项目”的链接,请单击它以安装缺少的组件。

You can use flutter build apk .您可以使用flutter build apk Just type the following in your terminal:只需在终端中输入以下内容:

 flutter build apk --split-per-abi

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

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