我在Eclipse中執行我的Maven Android應用程序項目時缺少AndroidManifest.xml文件。但AndroidManifest.xml存在於我的項目中,並且pom.xml已成功編譯和構建。AndroidManifest.xml文件在運行Maven Android項目時丟失錯誤
項目目錄結構:
/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/assets
/MavenTestProject/bin
/MavenTestProject/res
/MavenTestProject/src
/MavenTestProject/target
/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文件丟失。
任何人都可以幫我解決這個問題嗎?
非常感謝朋友,它確實有效。 –