在Eclipse中执行我的Maven Android应用程序项目时,我错过了AndroidManifest.xml文件。但AndroidManifest.xml存在于我的项目中,并且pom.xml已成功编译和构建。
项目目录结构:
/ MavenTestProject /根
/ MavenTestProject / SRC /主/ JAVA
com.ap.amrit.MavenTestProject
/ MavenTestProject / SRC /主/爪哇/
COM / AP /阿姆里特/ MavenTestProject /
-HelloAndroidActivity.java
/ MavenTestProject / SRC /测试/ 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文件。
有人可以帮我解决这个问题吗?
答案 0 :(得分:5)
哈哈..eclipse有时会试图欺骗用户..,你得到AndroidManifest.xml缺失错误,因为它不存在于你项目的bin文件夹中。请尝试清洁&amp;如果需要,请再次构建项目,如果bin文件夹中存在Androidmanifest.xml,则尝试刷新项目并进行交叉检查。玩得开心..!!享受!!