在Eclipse中执行我的Maven Android应用程序项目时,我缺少AndroidManifest.xml文件。但是我的项目中存在AndroidManifest.xml,并且pom.xml已成功编译和构建。
项目目录结构:
/ MavenTestProject / gen
/ MavenTestProject / src / main / java
com.ap.amrit.MavenTestProject
/ MavenTestProject / src / main / java /
com / ap / amrit / MavenTestProject /
-HelloAndroidActivity.java
/ MavenTestProject / src / test / java
/ MavenTestProject /资产
/ MavenTestProject / bin
/ MavenTestProject / res
/ MavenTestProject / src
/ MavenTestProject /目标
/MavenTestProject/AndroidManifest.xml
/MavenTestProject/pom.xml
/MavenTestProject/project.properties
pom.xml文件中的内容:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ap.amrit</groupId>
<artifactId>MavenTestProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>MavenTestProject</name>
<properties>
<platform.version></platform.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.6</source>
<target>1.6</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.7.0_03\bin\javac.exe
</executable>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.0</version>
<extensions>true</extensions>
<configuration>
<sdk>
<path>E:\utils\AndroidSDK</path>
<platform>17</platform>
</sdk>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
</plugin>
</plugins>
</build>
pom.xml文件已成功构建,但是在将项目作为Android应用程序项目运行时,显示“错误:由于您的项目包含错误,请在运行前对其进行修复。”在问题部分,它显示缺少AndroidManifest.xml文件。
有人可以帮我解决这个问题吗?
最佳答案
Haha..eclipse有时会愚弄用户..,您将收到AndroidManifest.xml丢失错误,因为该错误不在您项目的bin文件夹中。请尝试再次清理并构建您的项目,如果需要,请尝试刷新项目并交叉检查bin文件夹中是否存在Androidmanifest.xml。玩得开心..!!请享用!!